Reputation: 18739
I get this warning when building my project:
Warning 1 The following assembly has dependencies on a version of the .NET Framework that is higher than the target and might not load correctly during runtime causing a failure: MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. The dependencies are: System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. You should either ensure that the dependent assembly is correct for the target framework, or ensure that the target framework you are addressing is that of the dependent assembly. ASPNETCOMPILER 0 0 MyProject
At first I thought this meant I should update the project reference to System.Net.Http
so that it points at the 4.0 version - but on inspection it already points at the 4.0 version.
More to the point, the project targets framework version 4.5.1, so I don't see how it can be true. Neither 2.0 nor 4.0 is higher than 4.5.1 so the question is, what could this warning really indicate?
Upvotes: 9
Views: 10602
Reputation: 18739
Hans' comment about using ildasm reminded me of Reflector. Unfortunately Redgate got hold of that and it ceased being freely available even in earlier versions.
Fortunately there is ILSpy.
It turns out that the dependency on System.Net.Http, Version=2.0.0.0 is in System.Web.Http.WebHost, Version=4.0.0.0
Yes, it's a defect in the framework.
Fixed in 4.5.2 according to DFTR's comment:
We upgraded all library code and rest API's to .Net 4.5.2. Everything works magically.
Upvotes: 11