Resolving dotnetcore xunit tests Visual Studio not running and being marked as Inconclusive

You are trying to run dotnet core XUnit tests in Visual Studio 2017 and for some reason they are being marked as inconclusive. Of course, insure the relevant adapter is installed (whether you are using xunit, nunit or MS Test).

  • open a Developer Command prompt
  • navigate to the directory in which the tests csproj file is located.
  • run the same tests using the dotnet command. Something like: dotnet test

You will probably find an error similar to this:

This should show multiple dotnet versions installed.

If this is the case, the most likely reason the tests are not running is Visual Studio/dotnet don't know which specific dotnet version/platform the tests as supposed to run under.

This can be simply fixed by adding some tags to the tests csproj file. Add something like this:

Ensure the tags:

<RuntimeFrameworkVersion>2.2.0-preview3-27014-02</RuntimeFrameworkVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

are added to the tests csproj file and save. This makes it explicit which dotnet runtime and platform to use when running the tests. Of course it's easiest to select one of the runtime that's already installed as shown in the command window above.

You should now find the tests run both in the command line and in Visual Studio.