For the life of me I can't get unit testing working in Visual Studio 2017 from the new msbuild-based netcoreapp1.0
xunit project template.
The requirement is for unit tests to work both inside Visual Studio (for the devs) and from dotnet test
on the CLI for the automated build process however, I can't get either working consistently.
Here is what I have tried:
In an existing solution, create a new project and select .NET Core > xUnit Test Project.
Build project from Visual Studio, default test appears and runs successfully, now run dotnet test
from powershell prompt, get:
> dotnet test
Test run for D:\...\bin\Debug\netcoreapp1.0\MyProj.dll(.NETCoreApp,Version=v1.0)
dotnet exec needs a managed .dll or .exe extension. The application specified was 'C:\Program'
Or dotnet test with csproj file:
> dotnet test MyProject.csproj
(same error as above)
> dotnet test ..\MySolution.sln
Couldn't find a project to run test from. Ensure a project exists in D:\...
Or pass the path to the project
If I add the xunit.runner.console
or xunit.runner.msbuild
nuget packages, it stops the unit tests working from inside Visual Studio.
How do I get both working at the same time?
Thanks!