My XUnit Tests won’t run in a .Net Standard 2.0 Class Library

March 03, 2019

Firstly, this isn’t a bug, or something that you might have done wrong; it’s intentional. Essentially, you can’t run a .Net Standard Library, so your tests aren’t runnable.

Okay - so I want to convert to .Net Core 3.0!

Yep - that’s exactly what you want, and it’s this easy; open up the csproj file - it’ll look like this:

[code lang=“xml”] netstandard2.0

And replace it with this:

[code lang="xml"]
<Project Sdk="Microsoft.NET.Sdk">

And that’s it - your tests should now run!

Profile picture

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

© Paul Michaels 2022