5
votes

i have installed the nuget package for asp.net webapi 2.2. and now when i am executing this command

PM> Install-Package Microsoft.AspNet.WebApi.Cors

from nuget package manager it is showing this error.

Install-Package : Unable to find package 'Microsoft.AspNet.WebApi.Cors'. At line:1 char:1 + Install-Package Microsoft.AspNet.WebApi.Cors + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

3
If this is through Visual Studio can you try going through the graphical user interface instead of command-line? - helgeheldre
@ankipatel , can you share version of Visual Studio and Framework? - prabhakaran S
how? can u explain it? please... - ankitpatel tops
visual studio version 2013, framework 4.5 - ankitpatel tops

3 Answers

7
votes

Check the package source in the PackageManagerConsole Window. Change it to nuget.org from the dropdown, to install the package from the online repository.

enter image description here

2
votes

I have faced same issue . I have followed below steps and it works for me.

Before Install-Package Microsoft.AspNet.WebApi.Cors. check the nuget.org link in package manager settings.

In Visual studio click Tools->NuGet Package Manager->Package Manager settings

verify by selecting a tree item

NuGet Package Manager -> Package Sources

"**https://www.nuget.org/api/v2**" is added or not. If not then add this by given any name and source as this url. then try again to install WebApi.Cors

Install-Package Microsoft.AspNet.WebApi.Cors

0
votes

Try:

  1. Open visual studio as administrator.
  2. Clear cache.
  3. Install the package