ddl
ddl

Reputation: 31

XUnit tests not executed anymore with Visual Studio 17.4.0

Since upgrade to Visual Studio 2022 17.4.0, xunit tests are correctly displayed in test explorer, but they are not executed. They were correctly executed in previous versions. There is no error message.

We have "Tests in the group : 11". Results : 11 not executed.

Build is ok.

I'm using framework.net 4.8

Here is my project references

 <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
    <PackageReference Include="Moq" Version="4.18.2" />
    <PackageReference Include="xunit" Version="2.4.2" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="coverlet.collector" Version="3.2.0">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
  </ItemGroup>

Thanks.

Upgrading to VS Version 17.4.0.1 does not fix the problem. upgrading to Framework 4.8.1 neither. upgrading to latest version of xunit neither. Restarting, clearing and rebuild neither. Changing target processor to x64 or x86 or auto neither.

Upvotes: 1

Views: 512

Answers (2)

Brian Victor Baker
Brian Victor Baker

Reputation: 1

This was happening to me after a re-install of Visual Studio Community 2022 and just could not get tests to run.

The problem was that Microsoft had omitted from the build all of the unsupported frameworks, including .NET 6.0.

These are the steps for the fix:

  1. Open the Visual Studio Installer and choose 'Modify'
  2. On Components page, click the tab (at the top) 'Individual Components'
  3. Choose from the list the framework(s) you want included, for me it was .NET 6.0 Runtime.
  4. Click Install while downloading. 5 Once installed, Start VS and rebuild your solution.
  5. All tests appear and run!!

Upvotes: 0

ddl
ddl

Reputation: 31

The workaround is to downgrade Xunit package to xunit.runner.visualstudio 2.4.1 (last version is 2.4.5). I also downgraded Xunit to 2.4.1. Then I restarted the solution and the tests are running. Thanks Jérôme P. for the trick.

Upvotes: 2

Related Questions