title: Visual Studio New project wont run tests
body: <p>Visual Studio 2019 is not detecting or discovering NUNit nor MSTest unit tests at all. I installed it fresh just a week ago. The MS guide here <a href="https://docs.microsoft.com/en-us/visualstudio/test/getting-started-with-unit-testing?view=vs-2019&amp;tabs=mstest" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/visualstudio/test/getting-started-with-unit-testing?view=vs-2019&amp;tabs=mstest</a> does not work.</p>
  <p>A few threads hold possible solutions, but none that I've tried helped have helped. I'm new to C# so much of the steps have taken a long time to figure out, but while my application is progressing nicely I really want to work and learn in a TDD style.
  Even if a create a new blank MSTest project, with no application code or libs in the solution at all, the example/template project does not work, so I'm missing something big someplace. (I have .NET Core SDKs installed - my intent is to target macOS and linux at a future point.)</p>
  <pre><code>&lt;Project Sdk=&quot;Microsoft.NET.Sdk&quot;&gt;
    &lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;netcoreapp3.1&lt;/TargetFramework&gt;
      &lt;IsPackable&gt;false&lt;/IsPackable&gt;
      &lt;LangVersion&gt;latest&lt;/LangVersion&gt;
    &lt;/PropertyGroup&gt;
    &lt;ItemGroup&gt;
      &lt;PackageReference Include=&quot;nunit&quot; Version=&quot;3.13.0&quot; /&gt;
      &lt;PackageReference Include=&quot;NUnit3TestAdapter&quot; Version=&quot;3.17.0&quot; /&gt;
    &lt;/ItemGroup&gt;
  &lt;/Project&gt;
  </code></pre>
  <p>Threads I have tried: <a href="https://stackoverflow.com/questions/23363073/tests-not-running-in-test-explorer">Tests not running in Test Explorer</a> <a href="https://stackoverflow.com/questions/61150776/why-will-visual-studio-2019-will-not-run-my-unit-tests">Why will Visual Studio 2019 will not run my unit tests?</a> <a href="https://stackoverflow.com/questions/59350689/visual-studio-2019-test-explorer-puts-all-tests-under-not-run-tests">Visual Studio 2019 Test Explorer puts all tests under &quot;Not Run Tests&quot;</a>
  If I create a project targeting .NET 4.7 all is good, it's when I want to target Core that I'm unstuck, if that helps.</p>
  <p><strong>Stuck again</strong>
  I had to install a component called &quot;NUnit 3&quot;, <a href="https://marketplace.visualstudio.com/items?itemName=NUnitDevelopers.NUnitTemplatesforVisualStudio" rel="nofollow noreferrer">https://marketplace.visualstudio.com/items?itemName=NUnitDevelopers.NUnitTemplatesforVisualStudio</a> worked for a moment... but when I added a testcase, it all broke again.</p>
  <p>Did the nuget package updates, still not working.</p>
  <p>I cloned. from git this project <a href="https://github.com/dotnet/samples/tree/master/core/getting-started/unit-testing-using-nunit" rel="nofollow noreferrer">https://github.com/dotnet/samples/tree/master/core/getting-started/unit-testing-using-nunit</a>
  And it does not work either.</p>
  <p>I then re-installed 2019, and emailed my project to a friend, who merely removed the nunit nuget modules, added them back and then it worked for him, but the project he sent me back did not work. Module versions unchanged</p>
  <p>I opened the same project in the Microsoft developer VM/iso image and the project works just fine. so it's my environment that is incompatible with nunit somehow. Is there a way to see some traces?</p>
  <p>Changed the installation drive from D: to C: I get this error now</p>
  <pre><code>Testhost process exited with error: A fatal error occurred, the required library hostfxr.dll could not be found.
  If this is a self-contained application, that library should exist in [C:\Users\zapho\src\c#\tutorials\working\ConsoleApp1\ConsoleApp1\NUnit.Tests2\bin\Debug\netcoreapp3.1\].
  If this is a framework-dependent application, install the runtime in the default location [C:\Program Files\dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location.
  . Please check the diagnostic logs for more information.
  Testhost process exited with error: A fatal error occurred, the required library hostfxr.dll could not be found.
  If this is a self-contained application, that library should exist in [C:\Users\zapho\src\c#\tutorials\working\ConsoleApp1\ConsoleApp1\NUnit.Tests2\bin\Debug\netcoreapp3.1\].
  If this is a framework-dependent application, install the runtime in the default location [C:\Program Files\dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location.
  . Please check the diagnostic logs for more information.
  </code></pre>