Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install-Package : Unable to find package 'Microsoft.AspNet.WebApi.Cors'

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

like image 360
ankitpatel tops Avatar asked May 26 '16 06:05

ankitpatel tops


People also ask

How do I find the Web API version in Visual Studio?

To check this, you can open your solution, expand the webapi solution, then open the packages. config file that holds the nuget config for what you have installed. You should see some web api version message in the below. You can now go to the nuget website and examine the package history (visit the following link).

Which of the following command do we have to enter to add the CORS Nuget package?

To install CORS from the Nuget package, open the Package Manager Console and run the following command: Install-Package Microsoft. AspNet. WebApi.


2 Answers

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

like image 180
Chavi Gupta Avatar answered Nov 08 '22 22:11

Chavi Gupta


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

like image 3
Anand Kannan Avatar answered Nov 08 '22 22:11

Anand Kannan