TFS and Package Restore Error

Jul 9, 2012 at 9:08 PM
Edited Jul 9, 2012 at 9:26 PM

Hi, I am new to nugetter so I apologize if this is a 101 question but I have been stumped for a day on this. I have a CI build in TFS that is failing with the error message:

(I am running this on a TFS 2010 server with the latest version of nugetter)



I have enabled Package restore on my proj (right click on project and enable it). I have verified that my proj file has the following in it when opening it with a txt editor:



Is this perhaps not the real error? I've attempted to do the build locally using msbuild.exe at the command line on my machine and it works fine - it does make the appropriate nuget call to get the latest package...but on the build server I'm running into this roadblock.

Has anyone seen this before?



C:\Builds\3\83\Sources\.nuget\nuget.targets (76): 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'.

Jul 11, 2012 at 3:43 PM

Found my problem. It seems that this error message, which is being reported by the build server is inaccurate. The real issue was the certificate issue floating around: "The remote certificate is invalid according to the validation procedure". I figured this out by logging directly into our TFS build server and executing the msbuild command from the console. Two ways to fix this error: First, was to change the URL used when NuGet goes off to get packages to not use https://. The second, was to leave the URL alone and install the certificate that was being used by the site under the tfs build account/identity. This solved my problem.

I still can't get RestorePackages to work on the build server, but at least the certificate error is solved.



Aug 7, 2012 at 3:48 PM

To enable restore on the Build server you need to set a system Environmnet Variable on Server

EnableNuGetPackageRestore = true