xUnit Tests Not Recognizing Target Framework Microsoft.NETCore.App 2.0

Georg Dangl by Georg Dangl in DotNet Thursday, November 30, 2017

Thursday, November 30, 2017

Posted in Testing xUnit

My preferred unit testing framework for .Net Core, xUnit, has had quite a few changes for the 2.3 release. One of them was how the tests libraries themselves are executed and how the framework version was determined.

This becomes a problem when you have multiple frameworks for version 2.0 installed, e.g. 2.0.0 and 2.0.3. The compiler sets the version of .Net Core App to 2.0 when you target netcoreapp2.0, but then fails to resolve it to 2.0.0. livarcocc explains it here. You'll receive error messages like this when you attempt to run xUnit:

This isn't a bug within xUnit, but rather with the dotnet CLI, but xUnit still has a patch for this planned. In the meantime, you can set the RuntimeFrameworkVersion attribute in your *.csproj file to a fixed version when running tests for netcoreapp2.0:

Happy testing!


Share this post


comments powered by Disqus

About me

Hi, my name's George! I love coding and blogging about it. I focus on all things around .Net, Web Development and DevOps.

DanglIT

Need a consultant for BIM, GAEB or Software Development?

Contact me at [email protected], +49 (173) 56 45 689 or visit my professional page!

Dangl.Blog();
// Just 💗 Coding

Social Links