I recently updated my test project to .NET Core 3.1 from .NET 4.7.1 and I noticed this error when I was trying to run my tests:

Unable to find testhost.dll. Please publish your test project and retry.

Visual Studio error Please publish your test project and retry.

My first thought was to Publish my test project and attempt to run the tests again, this failed again. Giving me the same error message:

Unable to find testhost.dll. Please publish your test project and retry.

My next step was to add the nuget package Microsoft.NET.Test.SDK (I added version v16.5.0).

Nuget Package Microsoft.NET.Test.SDK version v16.5.0 screenshot from Visual Studio

And that seemed to help me over the initial “publish your test project and retry” hurdle.

But then I was met with this message:

Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. Visual Studio Screenshot of - Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.

The next step I took was to add the NUNIT3TestAdapter (v3.16.1) package to my project: Visual Studio screenshot of NUNIT3TestAdapter v3.16.1

Then after rebuilding the solution and running the tests, everything worked as expected with all tests running.

My Project was built on .NET Core 3.1 using Microsoft Visual Studio Community 2019 Version 16.4.5

I hoped this post helped you out and thanks for reading!

-Brendan Sluke

Helpful Stack Overflow Links:

Other References for this Problem: