Search code examples
c#.netvisual-studiounit-testingxunit

"No tests found to run" Xunit test not detected in Test explorer, Visual Studio 2022


As you guys can see on the screenshot, i can run my Xunit test through cmd, however in Test Explorer no test was found.

I have these packages from nuget:

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0-preview-20220726-02" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">

enter image description here

I have tried the following fix after doing some research on internet:

  1. Deleting .vs folder
  2. Clicked Run all tests in view button
  3. Installing other packages suggested in other posts for similar problem, clean, rebuild
  4. Restart VS, PC. Close and re-open Test Exlorer
  5. Changing from auto to x86/x64

None of above worked. If you have any tips that might fix this for me, please let me know, thank you.


Solution

  • So it couldn't find my tests because i had no solution, the video i watched created projects through cmd, he explained that in an other video after that.