Xunit Tests Won’t Run After Upgrade to .Net 6

February 06, 2022

Some time ago, while trying to get .Net Core 3.1 to work with Xunit, I discovered that 2.4.1 was the correct library to use for xunit.runner.visualstudio. At the time, I wasn’t sure why this was the case.

Recently, after upgrading an Azure Function to .Net 6 from 5, I came across almost the reverse problem. It turns out that 2.4.3 actually works fine for xunit.runner.visualstudio, however, you need to include the following library as well:


For .Net 6, if you want to run Xunit, then you need the following libraries:

[code lang=“xml”]

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />

<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.console" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />

# References


Profile picture

A blog about one man's journey through code… and some pictures of the Peak District

© Paul Michaels 2022