title: Visual Studio 2015 or 2017 does not discover unit tests
body: <p><strong>EDIT 2016-10-19:</strong></p>
  
  <p>The original question was about an issue specific to VS2015 CTP6 with the XUnit test runner. It's clear from the answers that there is a much broader issue with unit test discovery in Visual Studio which may occur in many different situations. I have cleaned up my question to reflect that.</p>
  
  <p>I have also included a script in my own answer that I still use to this day to solve similar problems when they appear.</p>
  
  <p>Many other answers have also proven helpful in better understanding the intricacies of the VS test runner. I appreciate that people are still sharing their solutions!</p>
  
  <hr>
  
  <p><strong>Original question 2015-04-10:</strong></p>
  
  <p>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.</p>
  
  <p>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:</p>
  
  <p><code>Could not load file or assembly 'Microsoft.VisualStudio.Web.ProjectSystem, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.</code></p>
  
  <p>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 <code>4.0</code>, <code>4.5.2</code> and <code>4.6</code>.</p>
  
  <p>I tried with the following testing frameworks and all of them give the same behavior:</p>
  
  <ul>
  <li><code>Microsoft.VisualStudio.QualityTools.UnitTestFramework v14.0.22609.0</code></li>
  <li><code>xunit v2.1.0-beta1-build2945</code> with <code>xunit.runner.visualstudio v2.1.0-beta1-build1051</code></li>
  <li><code>NUnit v2.6.4</code> with <code>NUnitTestAdapter v2.0.0</code></li>
  </ul>
  
  <hr>
  
  <p>I found an issue on GitHub (xunit) that appeared to be similar: <a href="https://github.com/xunit/xunit/issues/295">Cannot get tests discovered #295</a>, with this comment from the xunit team:</p>
  
  <blockquote>
    <p>Be aware that Visual Studio 2015 CTP 5 has been reported to be broken
    by many people with unit testing in general (not just xUnit.net), so
    don't expect that to work.</p>
    
    <p>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).</p>
  </blockquote>
  
  <p>I tried their suggestion to delete the folder <code>%TEMP%\VisualStudioTestExplorerExtensions</code>. Unfortunately that did not fix the problem.</p>
  
  <p>I noticed that ReSharper actually <strong>is</strong> able to discover some tests. It only works for the VS and NUnit tests, not for xunit.</p>
  
  <p>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.</p>