Tuesday, February 11, 2014

Enable NuGet package restore in Visual Studio

Having a build process for each solution is very useful, but we can have some errors like these:
  • C:\Builds\[…]\.nuget\nuget.targets(76,9): 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’.
  • C:\Builds\[…]\.nuget\nuget.targets(76,9): error MSB3073: The command “”C:\Builds\[…]\.nuget\nuget.exe” install “C:\Builds\[…]\packages.config” -source “” -o “C:\Builds\[…]\packages”" exited with code 1.
We use NuGet in Visual Studio 2012 RC with TFS 2012 RC: we want to enable missing NuGet packages restoring and we would prefer to not check-in packages into source control. So, in Visual Studio Solution Explorer, right click on solution and click on “Enable NuGet Package Restore”:

Solution: Enable NuGet Package Restore

Do you want to configure this solution to download and restore missing NuGet packages during build? Yes, of course:
NuGet Package Manager: Enable NuGet Package Restore

A .nuget folder is added to the root of the solution.
NuGet Package Manager: finished configuring this solution to restore NuGet packages on build

 

No comments:

Post a Comment