NuGet package restore – “Package restore is disabled by default. To give consent, open the Visual Studio Options dialog”

nuget

I'm trying to use NuGet package restore from the command line on a build server.

nuget install myapp/packages.config

However, I get the following error message:

Package restore is disabled by default. To give consent, open the Visual Studio Options dialog.

How am I supposed to do that without installing VS2010 on the build server? (no, I'm not doing that). Is there a registry setting or something? How is NuGet determining that package restore is disabled. Indeed, why is this something that they would even care about making disabled by default?

Best Answer

Another way is adding

<packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
</packageRestore>

to file %USERPROFILE%\AppData\Roaming\NuGet\nuget.config.

Related Topic