Nuget updates packages during build even when configured to not

落爺英雄遲暮 提交于 2019-12-08 02:45:49

问题


In

tools->options->Nuget Package Manager->General

I have configured nuget like this:

[ ] Allow NuGet to download missing packages
  [ ] Automatically check for missing packages during build in Visual Studio

When I build my project, I get messages like this:

33>  Restoring NuGet packages...
33>  To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'.
33>  All packages listed in packages.config are already installed.

But I unchecked that option, so why do I get those messages?


回答1:


This is because your project is using the older now deprecated NuGet package restore that is MSBuild based and runs NuGet.exe on every build. These messages are from NuGet.exe.

To prevent this from happening you should be able to set RestorePackages to false in each project file but NuGet seems to like to keep setting this back to true for some reason.

 <RestorePackages>false</RestorePackages>

Another way would be to not use the MSBuild based NuGet package restore and remove it. Then if you build within Visual Studio, and are using a recent version of the NuGet package manager, the NuGet packages will be automatically restored by Visual Studio just before the build.



来源:https://stackoverflow.com/questions/31180942/nuget-updates-packages-during-build-even-when-configured-to-not

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!