Reputation: 693
I have a customer who must build our software at their site, but the group policy prevents NuGet from running. This causes the build to fail. All of the packages already exist within the project (stored in version control), so there is no need for NuGet to even run.
Is there a way to prevent NuGet.exe from running?
Upvotes: 2
Views: 5499
Reputation: 14981
NuGet.exe is never run manually, so if it's running, you can change your build script to stop calling it. Visual Studio 2010, 2012 and 2013 had a feature to "Enable NuGet Package Restore on Solution", which would download a NuGet.Targets file and NuGet.exe, save it into a .nuget
directory and modify every .NET project file to import the nuget.targets
file. If your project is a carry over from these times, you should remove those changes as Visual Studio 2015, 2017 and 2019 have better integrated support for NuGet. However, in those cases you will need to make sure that any build script that runs on CI does a separate nuget restore, as it will no longer happen automatically as part of a MSBuild build.
In Visual Studio 2015 onwards, in Tools->Options, NuGet Package Manager->General there is an option "Automatically check for missing packages during build in Visual Studio" which you can turn off.
With the dotnet cli, you can use the --no-restore
option on commands that might implicitly restore.
Upvotes: 5