Build/Test Issues

ncrunch chooses incorrect target with multi-targetted project reference

Started by rlawley on 1,694 views

I've noticed that when using net5 test projects which reference multi-targeted libraries (net472 & netstandard2.1), ncrunch chooses the incorrect version to make available. For me, this has led to type load exceptions as it tries to execute net framework code which doesn't work in net5, even though there's a net standard version available.

I've created a much simplified proof of concept to show this, at https://github.com/richardlawley/Net5ncrunchProblemDemo

  • Lib is a class library with <TargetFrameworks>net472;netstandard2.1</TargetFrameworks>. To check which version is in use, this uses conditional compilation to return a different string.
  • Test is a net5.0 test project, with a project reference to Lib.


When run via ncrunch, the net472 version of Lib is supplied rather than the netstandard2.1 version, and the test fails. When run via dotnet test or using Visual Studio's test runners, the test passes. If the test project is changed to netcoreapp3.1, everything works as expected.

Tested on ncrunch 4.5 stable and the 4.6.0.1 version linked in another forum thread.

Regards,
Richard

Edited

Thanks Richard. Our multi-framework resolver probably needs adjustment here. I appreciate the code sample. We'll take a look :)
Would you be interested in trying the build below to see if this solves the issue?

NCrunch_Console_4.6.0.2.msi
NCrunch_Console_4.6.0.2.zip
NCrunch_GridNodeServer_4.6.0.2.msi
NCrunch_GridNodeServer_4.6.0.2.zip
NCrunch_LicenseServer_4.6.0.2.zip
NCrunch_VS2008_4.6.0.2.msi
NCrunch_VS2010_4.6.0.2.msi
NCrunch_VS2010_4.6.0.2.zip
NCrunch_VS2012_4.6.0.2.msi
NCrunch_VS2012_4.6.0.2.zip
NCrunch_VS2013_4.6.0.2.msi
NCrunch_VS2013_4.6.0.2.zip
NCrunch_VS2015_4.6.0.2.msi
NCrunch_VS2015_4.6.0.2.msi.7z
NCrunch_VS2015_4.6.0.2.zip
NCrunch_VS2017_4.6.0.2.msi
NCrunch_VS2017_4.6.0.2.msi.7z
NCrunch_VS2017_4.6.0.2.zip
NCrunch_VS2019_4.6.0.2.msi
NCrunch_VS2019_4.6.0.2.msi.7z
NCrunch_VS2019_4.6.0.2.zip
This looks like it's fixed the issue - both my proof of concept and production projects which were failing before pass with the new build.

Thanks!

Post a reply

Log in to reply.