Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

ncrunch chooses incorrect target with multi-targetted project reference
rlawley
#1 Posted : Saturday, November 14, 2020 3:04:10 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/7/2014(UTC)
Posts: 9
Location: United Kingdom

Thanks: 1 times
Was thanked: 3 time(s) in 3 post(s)
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/richa.../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
Remco
#2 Posted : Saturday, November 14, 2020 10:20:58 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,201

Thanks: 807 times
Was thanked: 1065 time(s) in 1012 post(s)
Thanks Richard. Our multi-framework resolver probably needs adjustment here. I appreciate the code sample. We'll take a look :)
Remco
#3 Posted : Wednesday, November 18, 2020 3:16:45 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,201

Thanks: 807 times
Was thanked: 1065 time(s) in 1012 post(s)
rlawley
#4 Posted : Wednesday, November 18, 2020 8:44:46 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/7/2014(UTC)
Posts: 9
Location: United Kingdom

Thanks: 1 times
Was thanked: 3 time(s) in 3 post(s)
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!
1 user thanked rlawley for this useful post.
Remco on 11/18/2020(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.038 seconds.