After installing Visual Studio 2017 Community, I tried creating a .NET Core unit test project. With the default output paths things work fine. But changing the intermediate output path to anything other than .\obj results in the following error.
Starting test execution, please wait... Could not find testhost.dll for source 'C:\temp\vs\cl1\p4\bin\Debug\netcoreapp1.1\p4.dll'. Make sure test project has a nuget reference of package "microsoft.testplatform.testhost".
Repro steps:
- Open a dotnet cli prompt.
- md p4
- cd p4
- dotnet new mstest
edit p4.csproj to change the intermediate output path to something like obj2\.
<PropertyGroup> <TargetFramework>netcoreapp1.1</TargetFramework> <BaseIntermediateOutputPath>obj2\</BaseIntermediateOutputPath> </PropertyGroup>
dotnet restore
- dotnet build
- dotnet test
The same problem happens for both mstest and xunit projects.
Changing the output path (OutputPath) seems to work fine. It's just the intermediate output paths (BaseIntermediateOutputPath and IntermediateOutputPath) that seems to be a problem.
Adding an explicit package reference to Microsoft.TestPlatform.TestHost, as the error suggests, does not seem to help.
In the Visual Studio IDE, the same problem (presumably) manifests itself as no unit tests appearing in the Test Explorer tool window.