Visual Studio does not discover xUnit tests for net6 project

Viewed 6

I have xUnit test project, and target framework for this test project is set to net6

project-properties

When I run my tests Visual Studio reports that 0 tests are found and tests are not launched.

xunit.runner.visualstudio package is installed as dependency, but tests are not discovered.

When I change target framework to NetCore, tests are being discovered ok, but for .net6 Visual Studio reports 0 found tests.

How can I fix this issue?

1 Answers

To fix this issue you should install Microsoft.NET.Test.SDK as the test project dependency.

And after that Visual Studio starts discovering tests for .net6 test project.

Related