vstest: Unable to run NUnit unit test. 'Unable to find testhost.dll Please publish your test project and retry.'

Description

Unable to run NUnit unit test. ‘Unable to find testhost.dll Please publish your test project and retry.’

Diagnostic logs

[12/12/2018 8:33:52 AM Informational] ------ Discover test started ------ [12/12/2018 8:33:54 AM Error] Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.GetTestHostPath(String runtimeConfigDevPath, String depsFilePath, String sourceDirectory) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.GetTestHostProcessStartInfo(IEnumerable1 sources, IDictionary2 environmentVariables, TestRunnerConnectionInfo connectionInfo) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable1 sources) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyDiscoveryManager.DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEventsHandler2 eventHandler) [12/12/2018 8:33:55 AM Warning] No test is available in F:\Projects\Foundation\Foundation.Core\Foundation.Common.Unity\bin\Debug\netstandard2.0\Foundation.Common.Unity.dll F:\Projects\Foundation\Foundation.Core\Foundation.Common\bin\Debug\netstandard2.0\Foundation.Common.dll F:\Projects\Foundation\Foundation.Core\Foundation.Master.Unity\bin\Debug\netstandard2.0\Foundation.Master.Unity.dll F:\Projects\Foundation\Foundation.Core\Foundation.Master\bin\Debug\netstandard2.0\Foundation.Master.dll F:\Projects\LiteNetLib\LibSample\bin\Debug\LibSample.exe F:\Projects\LiteNetLib\LiteNetLibStandard\bin\Debug\netstandard2.0\LiteNetLib.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. [12/12/2018 8:33:55 AM Error] Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 "compatibility mode". at Microsoft.VisualStudio.TestPlatform.CommandLine.TestPlatformHelpers.TestRequestManager.UpdateRunSettingsIfRequired(String runsettingsXml, List1 sources, String& updatedRunSettingsXml) at Microsoft.VisualStudio.TestPlatform.CommandLine.TestPlatformHelpers.TestRequestManager.DiscoverTests(DiscoveryRequestPayload discoveryPayload, ITestDiscoveryEventsRegistrar discoveryEventsRegistrar, ProtocolConfig protocolConfig) at Microsoft.VisualStudio.TestPlatform.Client.DesignMode.DesignModeClient.<>c__DisplayClass20_0.<StartDiscovery>b__0() [12/12/2018 8:33:55 AM Informational] ========== Discover test finished: 0 found (0:00:03.71027) ========== [12/12/2018 8:34:11 AM Informational] ------ Discover test started ------ [12/12/2018 8:34:11 AM Error] Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.GetTestHostPath(String runtimeConfigDevPath, String depsFilePath, String sourceDirectory) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.GetTestHostProcessStartInfo(IEnumerable1 sources, IDictionary2 environmentVariables, TestRunnerConnectionInfo connectionInfo) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable1 sources) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyDiscoveryManager.DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEventsHandler2 eventHandler) [12/12/2018 8:34:11 AM Informational] ========== Discover test finished: 0 found (0:00:00.1339987) ========== [12/12/2018 8:34:45 AM Informational] ------ Run test started ------ [12/12/2018 8:34:45 AM Error] Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. [12/12/2018 8:34:45 AM Error] Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. [12/12/2018 8:34:45 AM Informational] ========== Run test finished: 0 run (0:00:00.6249972) ========== [12/12/2018 8:36:17 AM Informational] ------ Run test started ------ [12/12/2018 8:36:17 AM Error] Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. [12/12/2018 8:36:17 AM Error] Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. [12/12/2018 8:36:17 AM Informational] ========== Run test finished: 0 run (0:00:00.0799997) ========== [12/12/2018 8:37:43 AM Informational] ------ Discover test started ------ [12/12/2018 8:37:43 AM Error] Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.GetTestHostPath(String runtimeConfigDevPath, String depsFilePath, String sourceDirectory) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.GetTestHostProcessStartInfo(IEnumerable1 sources, IDictionary2 environmentVariables, TestRunnerConnectionInfo connectionInfo) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable1 sources) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyDiscoveryManager.DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEventsHandler2 eventHandler) [12/12/2018 8:37:44 AM Warning] No test is available in F:\Projects\Foundation\Foundation.Core\Foundation.Common.Unity\bin\Debug\netstandard2.0\Foundation.Common.Unity.dll F:\Projects\Foundation\Foundation.Core\Foundation.Common\bin\Debug\netstandard2.0\Foundation.Common.dll F:\Projects\Foundation\Foundation.Core\Foundation.Master.Unity\bin\Debug\netstandard2.0\Foundation.Master.Unity.dll F:\Projects\Foundation\Foundation.Core\Foundation.Master\bin\Debug\netstandard2.0\Foundation.Master.dll F:\Projects\LiteNetLib\LibSample\bin\Debug\LibSample.exe F:\Projects\LiteNetLib\LiteNetLibStandard\bin\Debug\netstandard2.0\LiteNetLib.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. [12/12/2018 8:37:44 AM Error] Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 “compatibility mode”. at Microsoft.VisualStudio.TestPlatform.CommandLine.TestPlatformHelpers.TestRequestManager.UpdateRunSettingsIfRequired(String runsettingsXml, List1 sources, String& updatedRunSettingsXml) at Microsoft.VisualStudio.TestPlatform.CommandLine.TestPlatformHelpers.TestRequestManager.DiscoverTests(DiscoveryRequestPayload discoveryPayload, ITestDiscoveryEventsRegistrar discoveryEventsRegistrar, ProtocolConfig protocolConfig) at Microsoft.VisualStudio.TestPlatform.Client.DesignMode.DesignModeClient.<>c__DisplayClass20_0.<StartDiscovery>b__0() [12/12/2018 8:37:44 AM Informational] ========== Discover test finished: 0 found (0:00:01.0479967) ========== [12/12/2018 8:37:44 AM Informational] ------ Run test started ------ [12/12/2018 8:37:44 AM Error] Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. [12/12/2018 8:37:44 AM Error] Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. [12/12/2018 8:37:44 AM Informational] ========== Run test finished: 0 run (0:00:00.1630037) ========== [12/12/2018 8:38:45 AM Informational] ------ Discover test started ------ [12/12/2018 8:38:45 AM Error] Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.GetTestHostPath(String runtimeConfigDevPath, String depsFilePath, String sourceDirectory) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.GetTestHostProcessStartInfo(IEnumerable1 sources, IDictionary2 environmentVariables, TestRunnerConnectionInfo connectionInfo) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable1 sources) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyDiscoveryManager.DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEventsHandler2 eventHandler) [12/12/2018 8:38:46 AM Warning] No test is available in F:\Projects\Foundation\Foundation.Core\Foundation.Common\bin\Debug\netstandard2.0\Foundation.Common.dll F:\Projects\LiteNetLib\LiteNetLibStandard\bin\Debug\netstandard2.0\LiteNetLib.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. [12/12/2018 8:38:47 AM Informational] ========== Discover test finished: 0 found (0:00:01.2309981) ========== [12/12/2018 8:38:53 AM Informational] ------ Run test started ------ [12/12/2018 8:38:53 AM Error] Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. [12/12/2018 8:38:53 AM Error] Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. [12/12/2018 8:38:53 AM Informational] ========== Run test finished: 0 run (0:00:00.0249969) ========== [12/12/2018 8:42:59 AM Informational] ------ Run test started ------ [12/12/2018 8:42:59 AM Error] Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. [12/12/2018 8:42:59 AM Error] Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. [12/12/2018 8:42:59 AM Informational] ========== Run test finished: 0 run (0:00:00.1819978) ========== [12/12/2018 8:43:49 AM Informational] ------ Run test started ------ [12/12/2018 8:43:49 AM Error] Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. [12/12/2018 8:43:49 AM Error] Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. [12/12/2018 8:43:49 AM Informational] ========== Run test finished: 0 run (0:00:00.0469877) ========== [12/12/2018 8:47:20 AM Informational] ------ Run test started ------ [12/12/2018 8:47:21 AM Error] Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. [12/12/2018 8:47:21 AM Error] Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. [12/12/2018 8:47:21 AM Informational] ========== Run test finished: 0 run (0:00:00.0779985) ========== [12/12/2018 8:49:43 AM Informational] ------ Discover test started ------ [12/12/2018 8:49:44 AM Error] Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.GetTestHostPath(String runtimeConfigDevPath, String depsFilePath, String sourceDirectory) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.GetTestHostProcessStartInfo(IEnumerable1 sources, IDictionary2 environmentVariables, TestRunnerConnectionInfo connectionInfo) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyDiscoveryManager.DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEventsHandler2 eventHandler) [12/12/2018 8:49:44 AM Warning] No test is available in F:\Projects\Foundation\Foundation.Core\Foundation.Master\bin\Debug\netstandard2.0\Foundation.Master.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. [12/12/2018 8:49:45 AM Informational] ========== Discover test finished: 0 found (0:00:01.1109946) ========== [12/12/2018 8:49:45 AM Informational] ------ Run test started ------ [12/12/2018 8:49:45 AM Error] Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. [12/12/2018 8:49:45 AM Error] Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. [12/12/2018 8:49:45 AM Informational] ========== Run test finished: 0 run (0:00:00.0789987) ========== [12/12/2018 8:51:47 AM Informational] Executing all tests in type ‘Foundation.Tests.NetDataTests’ [12/12/2018 8:51:47 AM Informational] ------ Run test started ------ [12/12/2018 8:51:47 AM Error] Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. [12/12/2018 8:51:47 AM Error] Unable to find F:\Projects\Foundation\Foundation.Core\Foundation.Common.Tests\bin\Debug\netcoreapp2.0\testhost.dll. Please publish your test project and retry. [12/12/2018 8:51:47 AM Informational] ========== Run test finished: 0 run (0:00:00.059002) ==========

Dependencies

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
<PackageReference Include="MSTest.TestAdapter" Version="1.3.1" />
<PackageReference Include="MSTest.TestFramework" Version="1.3.1" />

Environment

Windows, netcoreapp2.0

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (2 by maintainers)

Commits related to this issue

Most upvoted comments

Well I figured out my problem by comparing a working project with a non-working project. Apparently the VS and dotnet CLI test runners require that my test projects depend on the Microsoft.NET.Test.SDK NuGet package.

Solution is to install the Microsoft.NET.Test.Sdk:

Tools>Nuget Package Manager>Manage Nuget Packages For Solution…>Search for Microsoft.NET.Test.Sdk and install for your test project.

I was able to run NUnit wcf test using VS Test Explorer with nuget package references like below:

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />

I had no Microsoft.NET.Test.Sdk reference before found this issue

Exactly the same issue. To solve the problem, I had to install NunitTestAdapter and Microsoft.NET.Test.Sdk. Adding just one of them did not solve the problem. Adding NuintConsoleRunner had no impact on my problem.

Perhaps NUnit3TestAdapter should add Microsoft.NET.Test.Sdk as a dependency? Seriously, spent a good while on such a waste of bytes of a problem…

I had a different cause, beside the ones mentioned above. The testproject was created as a console application instead of a class library. Wasn’t a problem until an upgrade to .Net core 3.1

Exactly the same issue. To solve the problem, I had to install NunitTestAdapter and Microsoft.NET.Test.Sdk. Adding just one of them did not solve the problem.

I had the same issue even with the following installed:

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />

I was running from the bin folder but for some reason the Microsoft test DLLs were not being output to the bin folder. My solution was to publish the project and run dotnet vstest from the publish folder. Then it worked!

Had the same issue. I already had the nunit and NUnit3TestAdapter packages. The fix for me was to also add the NUnit.ConsoleRunner package. I think it’s because I was trying to run within the Visual Studio Test Explorer.