-
Notifications
You must be signed in to change notification settings - Fork 320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to run NUnit unit test. 'Unable to find testhost.dll Please publish your test project and retry.' #1870
Comments
Needed the NUnit test adapter project reference |
@NVentimiglia could you describe how you resolved this? The test adapter package has no project file so I don't understand your solution as described. I am already referencing the NUnit3TestAdapter in my test project. |
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. |
I was missing the NUnit test adapter nuget project reference |
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. |
facing same issue even after adding NUnit3TestAdapter , source and logs are attached
VSTS Logs Source |
@MuhammadBilalYar The only differences between your test project and mine are:
|
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. |
I was able to run NUnit wcf test using VS Test Explorer with nuget package references like below:
I had no |
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. |
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 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 |
@Gert-Jan-Vernooij do you have a simple repro for this please? I am trying to repro but can't. I am getting this instead:
|
I had the same issue even with the following installed:
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! |
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... |
The test.sdk should be forced into the project most of the times by the dotnet sdk or the new templates. Problem is when you have an older project that you run in new VS where the new version of vstest.console is built-in. If we updated the adapter then you would not see the change until you update it, but maybe adding suggestions to install Microsoft.NET.Test.Sdk to the timeout and error messages might help? Because then it will be in the updated vstest console that we are able to control. |
Fixed this issue by upgrading |
For me the assembly name was wrong it was b.c changing it in projects properties to a.b.c solved it. |
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(IEnumerable
1 sources, IDictionary
2 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: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, List
1 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.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(IEnumerable
1 sources, IDictionary
2 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: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(IEnumerable
1 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: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, List
1 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(IEnumerable
1 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: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(IEnumerable
1 sources, IDictionary
2 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
Environment
Windows, netcoreapp2.0
The text was updated successfully, but these errors were encountered: