Fred Kleuver Fred Kleuver - 1 year ago 196
C# Question

VS2015 CTP6 does not discover unit tests (resharper does discover some of them)

EDIT 2016-05-04:

Since we are now long past the VS2015 beta, the specific issue I had back then is probably not relevant anymore. But it seems like this question is still getting quite a few hits a year after I posted it, so I will share some of the lessons learned since then in the hopes that it helps some people with similar issues. Problems with VS extensions and upgrades come in all sorts of flavors, after all.

  1. The VS MEF Component Cache, located at
    can be a frequent source of problems with extensions.

Simply close VS and clear the folder. The cache will be automatically reconstructed when you start VS again. There's an extension which allows you to do this from the menu and this is typically one of the first things I try nowadays when I encounter any sort of issues in VS (and it helps quite often):

Deleting the
folders of your solution at the same time may help to rule out any inconsistencies in your build artifacts caused by a corrupted MEF component cache.

  1. Update VS and your extensions.

As simple and obvious as it may seem, updates to Visual Studio and/or extensions might be one of the most frequently overlooked solutions to common problems.
Double check
Extensions and Updates
Product Updates
Visual Studio Gallery
to see if you have missed anything, and install any updates before you proceed with potentially wasting a lot of time.

  1. Check for problems with your .NET framework installation

Microsoft has released a neat little tool for this and it has helped me solve an issue or two that occured after updating/installing different versions of the .NET framework in the wrong way:

  1. Check for issues with Windows Update, PATH and/or the registry

This is especially true for machines that have not been reinstalled for a long time and been through some of the earlier builds of Windows 10 and DNX/DNVM. They may be the cause of a myriad of problems such as leaving invalid references to frameworks in your registry and/or PATH after product renames, as was the case with
.NET 4.5.3
.NET 4.6

In some cases a fresh install may just be the most time efficient way to solve most/all of these types of problems in one go. I for one reinstalled everything when VS2015 went out of BETA, to get rid of all the clutter from the frequent updates and changes.

While slightly out of scope of the question, in some cases the following sequence of commands may help to fix (or at least identify) common problems in Windows in general and consequently also in Visual Studio:

  • dism /online /cleanup-image /restorehealth
    (checks and, if necessary, fixes your Windows component store)

  • sfc /scannow
    (uses checksums to look for corruptions in core Windows dlls and registry keys)

They may not always be able to fix the problems they detect. That can be a signal of an underlying problem with the OS that might make it impossible to fix the problem with VS, if not tackled first.

Original question:

Since yesterday, my Visual Studio Test Explorer won't discover tests for any of my projects. It does not show the green loading bar after building, either.

When I go to the Visual Studio Test Explorer and click "Run All", or when I right-click any test method and select "Run Tests", I get the following in my output window:

Could not load file or assembly 'Microsoft.VisualStudio.Web.ProjectSystem, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

I am running Visual Studio 2015 CTP 6 on Windows 10 Pro Technical Preview, build 10041. The .NET Framework version does not seem to matter - it happens on

I tried with the following testing frameworks and all of them give the same behavior:

  • Microsoft.VisualStudio.QualityTools.UnitTestFramework v14.0.22609.0

  • xunit v2.1.0-beta1-build2945
    xunit.runner.visualstudio v2.1.0-beta1-build1051

  • NUnit v2.6.4
    NUnitTestAdapter v2.0.0

I find it rather curious that Google returns zero results on "Microsoft.VisualStudio.Web.ProjectSystem" (with the quotes).

I get a few hits on MSDN but those articles all seem to be unrelated. Therefore I can't find any documentation on it, probably due to a discrepancy between the assembly and DLL name.

Question 1: Does anyone know (where to find information about) what this assembly does, where it's supposed to come from, and why it appears to be the culprit for discovering unit tests?

Now, it may (and probably does) have something to do with my attempt to build the ASP.NET and EntityFramework stack yesterday. I cloned the Universe repository (which includes the full stack) to my projects folder and ran
, as instructed by the readme. No errors besides a handful of login prompts for private repositories, which I manually canceled.

However, I couldn't open any of the AspNet solutions afterwards. I kept getting this error:

The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.Props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

Googling for "Microsoft.DNX.Props" (with the quotes) gave me one result, pointing to an issue on GitHub: Please provide pre-DNX feed for VS users until CPT7 is released #377

It appears to be a known issue caused by a lot of renaming that Microsoft did recently. I decided to leave that for now and wait for CTP 7.

Question 2: Is it possible that the AspNet Universe build script caused the problem with my unit tests?

I found an issue on GitHub (xunit) that appeared to be similar: Cannot get tests discovered #295, with this comment from the xunit team:

Be aware that Visual Studio 2015 CTP 5 has been reported to be broken
by many people with unit testing in general (not just, so
don't expect that to work.

Also, please make sure you've cleaned out Visual Studio's runner
cache. If it gets corrupted, Visual Studio will permanently misbehave
until it's deleted. To clear the cache, shut down all instances of
Visual Studio, then delete the folder
%TEMP%\VisualStudioTestExplorerExtensions (honestly, it probably
wouldn't hurt to delete everything in %TEMP% that can be deleted).

Although I have CTP 6 instead of 5, I tried their suggestion to delete the folder "%TEMP%\VisualStudioTestExplorerExtensions". Unfortunately that did not fix the problem.

Furthermore, I noticed (by chance) that ReSharper actually is able to discover some tests. It only works for the VS and NUnit tests, not for xunit. I prefer not to use ReSharper for testing though. The Visual Studio Test Explorer has what I need and (to me at least) is a lot more intuitive.

Question 3: How come Visual Studio is not able to discover any tests, but ReSharper is?

There has to be some sort of temp or cache folder I need to clear, but I know Visual Studio has many of them and not all of them can be deleted without unwanted side-effects.

Due to the scarcity of information / search results on the errors I'm getting, I'm a bit at a loss on what to try or search for.

Answer Source

All my unit tests are being discovered and run succesfully again.

I figured that clearing all cache and temp folder would be unlikely to cause problems which are more harmful than not being able to run any tests. So I cleared everything that even remotely looked like a Visual Studio-related temp or cache folder.

Since I did not have the time to go through everything one-by-one and then test in-between, I unfortunately don't know which one actually caused the problem.

The "solution"

I couldn't find a tool which already does this reliably, probably due to all the machine and version-specific paths that make it difficult to do so. Still, if anyone has a more efficient way to locate and clear/delete all temp/cache folders VS uses, I'd love to hear about it. You never know when VS decides to act up again.

These are all the steps I've taken:

  1. Signed out of Visual Studio with my Microsoft account
  2. Closed Visual Studio
  3. Used CCleaner to clear system and browser temp files/folders
  4. Manually cleared/deleted the following files/folders:

Folders under D:\Projects\... (this is where all my projects live)

  • All bin and obj folders (simple search)
  • The contents of the packages folders of the solutions I am working on

Folders under ...\AppData\Local\...

  • assembly
  • bower\cache
  • kpm\cache
  • Microsoft\ApplicationInsights
  • Microsoft\UnitTest
  • Microsoft\VisualStudio\14.0\1033\SpecificFolderCache.xml
  • Microsoft\VisualStudio\14.0\1033\ProjectTemplateMRU.xml
  • Microsoft\VisualStudio\14.0\ComponentModelCache
  • Microsoft\VisualStudio\14.0\Designer\ShadowCache
  • Microsoft\VisualStudio\14.0\ImageLibrary\cache
  • Microsoft\VisualStudio Services\6.0\Cache
  • Microsoft\VSCommon\VSAccountManagement\AdalCache.cache
  • Microsoft\WebsiteCache
  • NuGet\Cache
  • Temp

Folders under ...\AppData\Roaming\...

  • AxTools\VS10x (CodeMap extension)
  • bower\cache
  • npm-cache
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download