Code Analysis error Could not load file or assembly 'System.Net.Http, Version=2.0.0.0 in MVC4 Web API

前端 未结 4 817
醉话见心
醉话见心 2020-12-13 06:42

this problem is exactly the same as this post http://forums.asp.net/t/1807797.aspx/1?System+Net+Http+is+not+found and this one on StackOverflow

I have all the latest

4条回答
  •  清歌不尽
    2020-12-13 07:21

    I have had the same problem (couldn't build locally and remotely on azure). This workaround helped me: http://connect.microsoft.com/VisualStudio/feedback/details/760208/nuget-package-for-asp-net-mvc-4-web-api-does-not-reference-correct-net-4-5-assemblies#

    here is the part you need:

    Copy the System.Net.Http.dll and System.Net.Http.xml files contained in the packages\Microsoft.Net.Http.2.0.20710.0\lib\net40 directory to the packages\Microsoft.AspNet.WebApi.Core.4.0.20710.0\lib\net40 directory. Since the missing System.Net.Http.dll assembly is now in the same location as the referenced System.Web.Http.dll assembly, the code analysis can now properly resolve the conflicting System.Net.Http assembly.

提交回复
热议问题