Wednesday, 8 May 2013

NuGet on a build agent

In order to use NuGet on my Build Agents, there were a few hoops to jump through first.

It all began with a warning in my MSBuild output log:

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'.

For my purposes, I need to use the Visual Studio option, not the environment setting.

It should be a simple case of opening tools > extension manager in VS2010, and choosing to update NuGetPackage Manager. But, it is not.

The first hurdle is a message that reads:
The installation was unable to install the extension to all the selected products.

Inspecting the log file (see link on the dialog) and the real reason reveals itself to be:
The signature on the update version of 'NuGet Package Manager' does not match the signature on the installed version. Therefore, Extension Manager cannot install the update.

A quick scan around the internet, and the first intelligible suggestion was to delete this folder.
Close VS2010 first...

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft Corporation\NuGet Package Manager\*

After this, you're free to search for and install the latest version of the NuGet package manager.
Don't forget to use "Restart Now" on the Extension Manager dialogue.