tfscontinuous-integrationnugetcruisecontrol.netnuget-package-restore

How to enable CC.NET Build to download Nuget pckages


I have an existing CC.NET build machine#1 pointing to a tfs server#1, and it is configured to download Nuget packages automatically when we trigger the build. So, it builds fine when I create a new branch but only on the second run, as it errors out during the first run when it downloads the Nuget packages and dll's and in fact tells me to run the build again.

Now, I am trying to setup a backup tfs server2 and a backup new build server#2. The new build server also uses cc.net with exact config values as Build server#1 (except tfs URL) and points to tfs server2, which has the exact source files (.csproj, .sln) checked in. I also placed the Nuget.exe in the correct folder on the build machine, local to that project folder. But I keep getting Build failures because of the missing dlls, as the Nuget.exe restore is not configured and does not happen.

What are the exact steps I need to follow to ensure that the missing dll's are downloaded from Nuget when I run the build? Some people suggest having an environment variable and most are referring to how to do it within Visual Studio. But I want it not in VS but on the build machine pointing to the same exact set of .csproj,.sln files as Build Server1, where it correctly downloads from Nuget.

Thanks in advance.


Solution

  • Your issue may be caused by your nuget setting. You can try to open your project in VS and enable Allow NuGet to download missing packages option, or try to restore the packages with nuget.exe CLI: nuget restore MySolution.sln.

    You can refer to the following documentation, which provide many ways to restore packages:

    https://learn.microsoft.com/en-us/nuget/consume-packages/package-restore