“Package restore is disabled by default” in Visual Studio

While opening a solution that another developer (or ten) had worked on earlier, I came across this friendly NuGet error:

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’.

As I delved into Tools -> Options – Package Manager to set the required setting, I saw that it was already set.

After some StackOverflowing, I saw that a workaround for this was to set an environment variable. To do this in Windows 8, I went to Control Panel – System – Advanced and clicked on the “Environment Variables” button. I added a new system variable called “EnableNuGetPackageRestore”, and set its value to “true”.

After doing this, it still didn’t work. I found that I needed to close and reopen Visual Studio in order for the change to take effect.

Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: