code分析错误无法加载文件或程序集“System.Net.Http,版本= 2.0.0.0在MVC4的Web API [英] Code Analysis error Could not load file or assembly 'System.Net.Http, Version=2.0.0.0 in MVC4 Web API

查看:673
本文介绍了code分析错误无法加载文件或程序集“System.Net.Http,版本= 2.0.0.0在MVC4的Web API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题是完全一样的这个帖子<一个href=\"http://forums.asp.net/t/1807797.aspx/1?System%20Net%20Http%20is%20not%20found\">http://forums.asp.net/t/1807797.aspx/1?System+Net+Http+is+not+found而这其中的on计算器

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

我所有最新的RTM位,开始了新的MVC 4在.NET 4.5,加入的WebAPI的NuGet包,现在我的code分析失败的报道,在上面的链接相同的错误。

I have all the latest RTM bits, Started a new MVC 4 in .Net 4.5, added the WebAPI nuget package and now my code analysis fails with the same error as reported in the above link.

CA0058错误运行code分析CA0058:引用的程序集'System.Net.Http,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a'找不到。该组件需要分析和被引用:C:\\项目\\室内\\ TimeRecorder \\权宜之计\\ TimeRec \\ BIN \\ TimeRec.dll, C:\\Projects\\InHouse\\TimeRecorder\\StopGap\\packages\\Microsoft.AspNet.WebApi.Core.4.0.20710.0\\lib\
et40\\System.Web.Http.dll. [错误和警告] - (全球)

CA0058 Error Running Code Analysis CA0058 : The referenced assembly 'System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' could not be found. This assembly is required for analysis and was referenced by: C:\Projects\InHouse\TimeRecorder\StopGap\TimeRec\bin\TimeRec.dll, C:\Projects\InHouse\TimeRecorder\StopGap\packages\Microsoft.AspNet.WebApi.Core.4.0.20710.0\lib\net40\System.Web.Http.dll. [Errors and Warnings] - (Global)

这是我能找到这似乎因为是.NET 4.5框架System.Net.Http和的WebAPI的版本System.Net.Http之间的冲突与RC版本的情况发生。

From what I can find this seemed to happen with the RC versions because there was a conflict between the .NET 4.5 framework System.Net.Http and the WebApi's version of the System.Net.Http.

StackOverflow响应谈降级从.NET 4.5到4.0,原因很明显,这不是我的preferred解决方案!

The other answers on the StackOverflow response talk about downgrading from .Net 4.5 to 4.0, for obvious reasons, this is not my preferred solution!

推荐答案

请尝试以下操作:


  1. 根据您的Visual Studio版本定位到:

    • VS 2010

      的%ProgramFiles(x86)的%\\微软的Visual Studio 10.0 \\团队TOOLS \\静态分析工具\\ FxCop的

    • VS 2012

      的%ProgramFiles(x86)的%\\微软的Visual Studio 11.0 \\团队TOOLS \\静态分析工具\\ FxCop的

  1. Depending on your Visual Studio edition navigate to:
    • VS 2010:
      %ProgramFiles(x86)%\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop
    • VS 2012:
      %ProgramFiles(x86)%\Microsoft Visual Studio 11.0\Team Tools\Static Analysis Tools\FxCop

这篇关于code分析错误无法加载文件或程序集“System.Net.Http,版本= 2.0.0.0在MVC4的Web API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆