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

前端 未结 4 1418
栀梦
栀梦 2021-02-03 23:17

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 follow

相关标签:
4条回答
  • 2021-02-03 23:29

    Another way is adding

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

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

    0 讨论(0)
  • 2021-02-03 23:29

    I've got one today.

    Had the options checked in Visual studio 2013 but still got the error message. Workaround to set environment variable worked, you should restart visual studio after adding the environment variable

    0 讨论(0)
  • 2021-02-03 23:35

    This is currently happening because NuGet Package Restore needs consent before downloading packages and with the current way things work, there's no way to discern a user calling "nuget.exe install packages.config" from package restore. more details on consent here : http://blog.nuget.org/20120518/package-restore-and-consent.html

    note: this issue should be fixed next week.

    As a workaround, you can give consent by setting the EnableNuGetPackageRestore environment variable to true.

    0 讨论(0)
  • 2021-02-03 23:52

    Check updating NuGet if you are using an old version of Visual Studio. That worked for me.

    0 讨论(0)
提交回复
热议问题