In a large solution with 52 projects (all net462), the latest version of some of our dependencies are now only built for NET standard. Therefore they depend on the NuGet package NETStandard.Library
which in turn drags in a lot of other 4.3.x version of System.*
packages which are normally in the .NET Framework itself.
As a result, some projects reference System.*
libraries from the packages folder, while others reference System.*
libraries from the .NET Framework.
This causes the well-known runtime issue, f.e.:
Message: System.IO.FileLoadException : Could not load file or assembly 'System.Net.Http, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Digging into the dependencies of the NETStandard.Library
packages, we can see that the same issue also exists in these packages:
- System.Collections.*
- System.ComponentModel.*
- System.Console
- System.Globalization.*
- System.IO.*
- System.Linq.*
- System.Net.*
- System.ObjectModel
- System.Reflection.*
- System.Resources.ResourceManager
- System.Runtime.*
- System.Text.*
- System.Threading.*
- System.Xml.*
Normally this is fixed by installing the same package in the other projects, but we're dealing with a lot of projects and a lot of packages here and I don't want to blindly add all of those dependencies to all 52 projects.
This made me wonder whether anyone knows of an easy way to recover from this situation and to make all projects reference the correct package/DLL from the NuGet packages folder if they currently use the NET Framework internal one.
A simple VS-solution for net462 and net471 demonstrating the problem can be found here
System.Threading.Tasks.Extensions 4.4.0
and now a lot of unit tests are throwing the FileLoadException forSystem.Net.Http
. I'm about to burn this place down :p – huysentruitw