无法添加引用“System.Net.Http”。请确保它在全局程序集缓存 [英] Failed to add reference to 'System.Net.Http'. Please make sure that it is in the Global Assembly Cache

查看:5735
本文介绍了无法添加引用“System.Net.Http”。请确保它在全局程序集缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图 Microsoft.AspNet.WebApi 的NuGet包添加到C#类库项目。 这里的的情况下,项目源$ C ​​$ C 你需要它。

I am trying to add Microsoft.AspNet.WebApi Nuget Package to a C# Class Library Project. Here's the Project source code in case you need it.

当我在的NuGet包管理器控制台在Visual Studio 2013中执行以下命令(它有最新的.NET 4.5的吧)

When I execute the following command in the Nuget Package Manager Console in Visual Studio 2013 (it has latest .NET 4.5 in it)

PM> install-package Microsoft.AspNet.WebApi ErrandBoy.Web.Common

我收到以下错误。

I get the following Error.

PM> install-package Microsoft.AspNet.WebApi ErrandBoy.Web.Common
Attempting to resolve dependency 'Microsoft.AspNet.WebApi.WebHost (≥ 5.2.2 && < 5.3.0)'.
Attempting to resolve dependency 'Microsoft.AspNet.WebApi.Core (≥ 5.2.2 && < 5.3.0)'.
Attempting to resolve dependency 'Microsoft.AspNet.WebApi.Client (≥ 5.2.2)'.
Attempting to resolve dependency 'Newtonsoft.Json (≥ 6.0.4)'.
'Microsoft.AspNet.WebApi 5.2.2' already installed.
Adding 'Newtonsoft.Json 6.0.4' to ErrandBoy.Web.Common.
Successfully added 'Newtonsoft.Json 6.0.4' to ErrandBoy.Web.Common.
Adding 'Microsoft.AspNet.WebApi.Client 5.2.2' to ErrandBoy.Web.Common.
install-package : Failed to add reference to 'System.Net.Http'. Please make sure that it is in the Global Assembly Cache.
At line:1 char:1
+ install-package Microsoft.AspNet.WebApi ErrandBoy.Web.Common
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

特定的错误行如下。这似乎是它的尝试添加引用添加'Microsoft.AspNet.WebApi.Client 5.2.2

Failed to add reference to 'System.Net.Http'. Please make sure that it is 
in the Global Assembly Cache.

我以前从来没有得到这样的错误。我没有看到这个SO溢出问题类似的错误=> Error在安装ASP.NET身份2 的样品,但一个一直无人接听。

I've never gotten such an error before. I did see a similar error on this SO Overflow question => Error on installing ASP.NET Identity 2 Samples but that one has no answer.

https://github.com/theShiva/ErrandBoy

https://github.com/theShiva/ErrandBoy

推荐答案

我刚做了同样的问题。我通过手动添加 System.Net.Http 来引用解决它。然后,它抱怨别人,而是由一个手动一位代表补充他们之后,我能够用的NuGet安装软件包。

I just had the same issue. I solved it by manually adding System.Net.Http to the references. Then it complained about others, but after adding them manually one by one I was able to install the package with NuGet.

这篇关于无法添加引用“System.Net.Http”。请确保它在全局程序集缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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