How to Fix xUnit Test not Running Error – “Test project does not reference any .NET NuGet adapter”

Today I faced that Visual Studio 2022 does not run xUnit tests in the Test Explorer. And in the output I found the next error: “Test project MyProject does not reference any .NET NuGet adapter. Test discovery or execution might not work for this project.” To fix this issue I just added the ‘xunit.runner.visualstudio’ package:
xUnit minimal package required
Additionally, my issue was that I tried to create a new test project from the Class Library project template, not xUnit template. If you did the same way then just re-create your test project using the right template:
xnit VS template type

My artifacts are:

  • Visual Studio 2022
  • xunit 2.4.1 package
  • xunit.runner.visualstudio 2.4.3 package
  • .net Core 2.2 App I need to test

Leave a Comment