V4 of Xunit.V3 with VS Test?

It takes some time to work around breaking changes with my Xunit tests in the Azure Devops Pipeline

Some time ago I noticed that Xunit was marked as vulnerable on NuGet. Well - that was a bit dramatic, a new version was introduced: V3, with the suprisingly original name Xunit.V3.

However, a breaking change appeared when they quickly released a v4 version of Xunit.V3.

Suddenly, the tests in our Azure DevOps pipeline started failing, complaining about MSBuild targets that "Testing with VSTest target is no longer supported". The test step eventually ended with:

##[error]Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1

My supporting junior wizzkid Copilot didn't know what to do with it, came up with introducing <TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport> and some several roudtrip recreating different exception.

For now, I've pinned all test projects to xunit.v3. Yes, that's the "v3" package that you need to use because v4 was released. Got it?

  <PackageReference Include="xunit.v3" Version="[3.2.2,4.0.0)" />
  <PackageReference Include="xunit.runner.visualstudio" Version="[3.1.5,4.0.0)">
    <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    <PrivateAssets>all</PrivateAssets>
  </PackageReference>
  <PackageReference Include="coverlet.collector" Version="10.1.0">
    <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    <PrivateAssets>all</PrivateAssets>
  </PackageReference>
  <PackageReference Include="coverlet.msbuild" Version="10.1.0">
    <PrivateAssets>all</PrivateAssets>
    <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
  </PackageReference>

And well, I just also found this on the github of Xunit that I should read.

Issue on Github of Xunit
Issue on Github of Xunit
Tags: blog,contentor,orhowithinkitwork

Overzicht artikelen