can anyone help me get VS2017 to work with .NET Core test projects?
I tried creating both MSTest and xUnit unit test projects for .NET Core from the VS 2017 templates. Neither of them works in the test explorer (not discovered), however running dotnet test
from the project folder works fine.
Steps to reproduce:
Unit Test Project (.NET Core)
or xUnit Test Project (.NET Core)
templateRun All
At this point the Output window should tell you that 0 test were discovered
.csproj
file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
</ItemGroup>
</Project>
If I tried to create a MSTest unit test project from the template that targets .NET Framework (full, not .NET Core), it worked.
Any ideas?
In the end, the problem was solved by changing my system PATH
env. variable from C:\Program Files\dotnet\
to C:\Progra~1\dotnet\
, as answered in Can't get XUnit tests working with Visual Studio 2017 RC
Thanks to Alexey for suggesting it in the comments :)