Compile can not resolve System.Net.Http in currently targeted framework

<assembly> could not be resolved because it has an indirect dependency on the framework assembly "System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0"

On my machine I have .NET v4.5 installed along with VS2012 which has mostly been working fine. Out of the blue I started getting the above error despite the build server passing. A quick google search reveals that the assemblies in question are actually missing from the v4.0 folder for some reason.

I installed ASP.NET MVC 4 using the web platform installer to try and get the assemblies put into the correct folder however they were still only in the v4.5 folder!

The fix for me was unfortunately to copy them over from:

C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies

To the following folder:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0.

Now my build is passing but the fix isn’t satisfactory in my mind.

blog comments powered by Disqus