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?
NET Framework version. To update the target framework for all projects, right-click on the project (one by one), click properties, and from the “Application” tab change the target framework to the desired one as in the following screenshot and select “Yes” in the popup that is displayed after the framework is changed.
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 see DFTR's comment below.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With