Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget does not download missing packages in Visual Studio 2010

I go to Tools -> Options -> Package Manager -> Allow Nuget... to have the option enabled already. I opened Package Manager Console and typed install-package MyPackageName to install NuGet package successfully, and package folder was created fine. I am pretty sure I have latest version of NuGet installed already.

I closed solution and my VS2010, I deleted package folder, reopen the solution in VS2010, but it does not download any packages at all.

I think I should see a .nuget folder in solution, but it is not there.

Any clue?

like image 488
hardywang Avatar asked May 29 '13 01:05

hardywang


People also ask

How do I allow NuGet to download missing packages?

Enable package restore by choosing Tools > Options > NuGet Package Manager. Under Package Restore options, select Allow NuGet to download missing packages.

How do I fix a NuGet package error?

Quick solution for Visual Studio usersSelect the Tools > NuGet Package Manager > Package Manager Settings menu command. Set both options under Package Restore. Select OK. Build your project again.

How do I force a NuGet package to install?

Switch to the Browse tab, search for the package name, select it, then select Install). For all packages, delete the package folder, then run nuget install . For a single package, delete the package folder and use nuget install <id> to reinstall the same one.


1 Answers

You need to enable NuGet package restore on your solution. In the Solution Explorer, right-click on your solution and click 'Enable NuGet Package Restore'. This is what will created the .nuget directory and add the nuget targets that will drive the package restoration process.

See the official documentation for a walkthrough.

Edit: This answer might be somewhat obsolete. MSBuild-Integrated Package Restore is no longer the suggested package restoration option - have a look at either Automatic Package Restore or Command-Line Package Restore on the official NuGet package restoration documentation. Having said that, MSBuild-Integrated package restore still works, and is still supported.

like image 69
Matthew King Avatar answered Sep 28 '22 23:09

Matthew King