How does Nuget Restore task work? Does nuget.config in the solution have to match that of in the build server?

wonderfulworldwithcharity

enter image description hereI am new to Nuget and have added a Nuget restore step to install dependencies on the build server. When I looked up the Nuget restore, we need the Nuget.config file under the solution folder as well as in the local build machine where the build will be running. %Appdata%/Nuget/Nuget.config

My question is do the two nuget.config files need to match? Does the nuget.config file in the source repository replace the nuget.config in the build server during the build?

Merlin Liang

Do the two nuget.config files need to match?

For this question, the answer is No, they do not need be matched. As the doc defined:

enter image description here

While you enable this checkbox and execute this restore task, the server will just get the config file which has been under the repository source control. The config file which exists in your local build agent will not has any affect about this file. So, they don't need be matched.

Does the nuget.config file in the source repository replace the nuget.config in the build server during the build?

Yes, if the local config file has the same argument configuration with the one in repos, while the build running, the local one will be override by the file which in repos because of proximity principle.

For example, if you configured some about feed in the config file which in repos, but the local file does not. While the build running, the local file need use this value since the build server will take the local file.

So, for this question, the nuget.config file in the repository will override the nuget.config in the build server during the build. And also, the precondition about this is these two config file has the same argument configuration.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

NuGet auto package restore does not work with MSBuild

remove nuget package restore from solution

Visual Studio 2013 NuGet package restore does not work from command line (not msbuild but vcvarsall.bat)

Nuget Restore via build server "unable to find version"

adding nuget packages in TFS - does packages.config need to be Checked In?

MSBuild 15 NuGet restore and build

VSTS Build Definition : adding multiple feeds in Nuget restore task

Nuget package restore error in Docker Compose build

Nuget restore version conflict build error on VSTS

VSO Build Pipeline's Nuget Restore Failed

NuGet package restore in Azure DevOps build pipeline

How to use an API Key with dotnet restore with private NuGet server

Does Nuget Restore Install Latest Version?

What is NuGet and how does it work? [Expanding on Entity Framework]

EXEC: Unable to connect to the remote server on NuGet restore on TFS build server

Interop service does not work with NuGet WatiN

An error occurred while configuring the solution to restore NuGet packages on build. The operation has timed out

Nuget config and dnu restore on fresh windows install

Nuget restore for some team members does not work - Microsoft.AspNet.Mvc and other core packages

Nuget package restore error in build definition

How to successfully restore nuget packages for entire solution?

Restore NuGet Package in TeamCity Build and Deploy Step

How does NuGet contentFiles work?

TeamCity Build Server cannot restore nuget packages

Nuget xdt transform does not work for config files

Nuget does not restore packages from source control

Azure Devops private build agent failing at nuget restore task

Devops Nuget versioning byBuildNumber does not work

How does Visual Studio 2022 resolves (NuGet) dependencies for a solution?