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.
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
The specific error line is the following. It seems to be where it's trying to add reference to Adding '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.
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
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.
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