Nuget - Don't see allow nuget to download missing packages during build

46,675

Solution 1

The option to give consent in the UI has been added with NuGet Package Manager 1.8. It's the 3rd item under Tools-> Options-> Package Manager-> General : "Package Restore : Allow NuGet to download missing packages during build".

Please make sure NuGet is up-to-date in Tools->Extension Manager.

Alternatively you can give consent by setting the EnableNuGetPackageRestore Environment variable to true.

Solution 2

I found I needed an extra couple of steps to get it to download the packages

  1. Check Allow NuGet to download missing packages during build

  2. Check Always show solution in Projects and Solutions

  3. Right click on solution and Enable NuGet Package Restore

  4. Open Manage NuGet Packages and click Restore

Solution 3

I did not seem to have the "Package Manager" node under Tools->Options [this was in Visual Studio 2013 :-)]. To get that node in there, I browsed to Tools -> Extensions and Updates and searched for nuget. Installing "NuGet for Visual Studio 2013" got me the node and the option to allow package restore!

Solution 4

I am using Visual Studio 2010 and NuGet 2.0.

Someone had checked in a solution that used NuGet for various packages. When I checked out the solution and built it, I got the same errors. What's more, when I viewed the NuGet Package Manager from the Tools -> Options window, the Package Restore already had the appropriate check boxes checked.

I tried clicking the Clear Package Cache button. After doing that, everything built correctly.

enter image description here

Share:
46,675
Nate Pet
Author by

Nate Pet

Updated on June 18, 2020

Comments

  • Nate Pet
    Nate Pet almost 4 years

    I get a message saying the following:

    Error 1 Package restore is disabled by default. To give consent, open the Visual Studio Options dialog, click on Package Manager node and check 'Allow NuGet to download missing packages during build.' You can also give consent by setting the environment variable 'EnableNuGetPackageRestore' to 'true'.

    When I go to Tools -> Options, I do not see Package Manager and underneath I see Package Sources and Recent Packages. I do not see anywhere where I can set Allow Nuget to download missing packages during build though.

  • Zenuka
    Zenuka almost 12 years
    Updating nuget fixed the problem
  • JDPeckham
    JDPeckham over 11 years
    I had to use the environment variable after doing everything else and it still didn't work. (admittingly i had it disabled, had packages folder checked into svn and then deleted it, so maybe I had other corrupt state)
  • Guy Starbuck
    Guy Starbuck over 11 years
    I don't have that context menu item for "Enable NuGet Package Restore" showing up in the Solution context menu - I have the latest version of NuGet (2.0.30717.9005) installed in VS 2012. Has anyone had this problem?
  • surfen
    surfen over 11 years
    +1 I didn't have that first menu itme either. Nevertheless clicking Restore solved the issue.
  • Boris Parfenenkov
    Boris Parfenenkov about 10 years
    It is good advice to visit Manage NuGet Packages and click restore!
  • barrypicker
    barrypicker almost 10 years
    Like Guy Starbuck - I too do not have the option shown above. Also, no button 'Restore' in yellow bar appears in the Manage NuGet Packages section - yet I still get the error described by OP. Why does MS keep changing stuff so versions of the same tool exhibit different behaviors and differing verbiage - harder than hell to search for a solution...
  • FDS
    FDS over 9 years
    this worked for me on VS2012, both checkboxes were already checked, but clearing the package cache immediately resolved the error and allowed me to build. thanks!