Restoring NuGet packages from custom Nugetserver u

2019-06-01 18:46发布

问题:

We have a large number of solutions in our source control, which all use NuGet packages from a custom source (http://nugetserver/nuget). All solutions restore and build successfully locally within Visual Studio.

Using the new TFS 2015, our build definition looks like this:

The NuGet Installer step is there for us to restore our packages from a custom resource:

There is however no NuGet.exe file in the custom NuGet server directory. As suggested here tried just setting the -source to "https://www.nuget.org/api/v2/". We receive the same error at build whichever source we use:

回答1:

You're specifying a command line argument in the "Path to NuGet.exe" field. That field should be used if you want to use a different version of NuGet than the one that's baked into the build agent.

What you need to do to solve your problem is:

  • Add your custom NuGet server to the machine's NuGet.config

or

  • Add your custom NuGet server to the application's NuGet.config.

See the NuGet docs for more info.



回答2:

You're specifying the command line in the wrong field. That field is to use different version of NuGet.exe. You need to put your command in the NuGet Arguments field.

Additionally you might want to also add the default NuGet Feed to the available sources like this:

-source "https://www.nuget.org/api/v2/;http://nugetserver/nuget"