Build/Test Issues

Test project build fails on multi targeted project with different version of the same package

Started by Axima on 2,927 views

I have a class library that multi targets .NET Standard 2.0, .NET Standard 2.1, and .NET Framework 4.7.2.
I also have a unit test library which multi targets .NET Core 2.2, .NET Core 3.0 and .NET Framework 4.7.2.

The class libary uses Entity Framework packages, specifically:
.NET Standard 2.0: Microsoft.EntityFrameworkCore 2.2.6
.NET Standard 2.1: Microsoft.EntityFrameworkCore 3.0.0
.NET Framework 4.7.2: EntityFramework 6.3.0

These packages are conditionally included in the library .csproj file based on the target framework.

In Visual Studio all projects build fine and I can manually run any test against all 3 frameworks and they work.

NCrunch fails to build the test project for .NET Core 2.2 with the following error:

CSC (0, 0): Assembly 'Library' with identity 'Library, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'Microsoft.EntityFrameworkCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' which has a higher version than referenced assembly 'Microsoft.EntityFrameworkCore' with identity 'Microsoft.EntityFrameworkCore, Version=2.2.6.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'


It seems like it is not identifying that .NET Core 2.2 should load the 2.2.6 version of Microsoft.EntityFrameworkCore.
Hi, thanks for sharing this issue.

I appreciate the detail you've provided here. Is there any chance you can build us a small sample solution that reproduces this issue? If we can get this to fail in our environment in exactly the same way it fails in yours, I'm hopeful that we should be able to produce a fix. You can submit code in a ZIP file through the NCrunch contact form.
Hi Remco,

I created a small sample solution, however each time I try to submit the contact form I get a 404 error.

I have uploaded the solution for a 1 time download from here: https://send.firefox.com/download/87f1bc05a490da7f/#MXZWVDHCwy9kYcMPD48vSQ

Thanks,
Thanks for the sample project, and sorry about the problem with the contact form.

I can confirm that this sample reproduces the problem consistently on my end. I'll let you know as soon as I'm able to arrange a fix.
Hi,

Would you mind giving the build below a try? This works with the test project you provided.

NCrunch_Console_3.31.0.7.msi
NCrunch_Console_3.31.0.7.zip
NCrunch_GridNodeServer_3.31.0.7.msi
NCrunch_GridNodeServer_3.31.0.7.zip
NCrunch_LicenseServer_3.31.0.7.zip
NCrunch_VS2008_3.31.0.7.msi
NCrunch_VS2010_3.31.0.7.msi
NCrunch_VS2010_3.31.0.7.zip
NCrunch_VS2012_3.31.0.7.msi
NCrunch_VS2012_3.31.0.7.zip
NCrunch_VS2013_3.31.0.7.msi
NCrunch_VS2013_3.31.0.7.zip
NCrunch_VS2015_3.31.0.7.msi
NCrunch_VS2015_3.31.0.7.msi.7z
NCrunch_VS2015_3.31.0.7.zip
NCrunch_VS2017_3.31.0.7.msi
NCrunch_VS2017_3.31.0.7.msi.7z
NCrunch_VS2017_3.31.0.7.zip
NCrunch_VS2019_3.31.0.7.msi
NCrunch_VS2019_3.31.0.7.msi.7z
NCrunch_VS2019_3.31.0.7.zip
That works, thanks.
That's great, thanks for reporting back!

Post a reply

Log in to reply.