Use a local Nuget.config file if exists

Aug 8, 2011 at 9:48 AM
Edited Aug 8, 2011 at 9:49 AM


in my company, we are investigating the usage of NuGet in order to manage our internals and externals dependencies. We want integrate it to our build process, but we have two main issues :

For the second issue, actually (and as a work-around), we specify the -Source option in every projects. But our dev branch and our staging branch don't use the same version of internals packages and we use two different feeds for it (one for dev and one for staging). So we could have some issues when merging the branch.

If we could have a local Nuget.config next to our Nuget.exe (in the "Tools" folder of the solution), we could ignore this file during the merge process and defined the feed URL in one place per solution.

I think this can be done in two ways:

  • the local config file completly replaces the "global" config file (in the "%APPDATA%/Nuget/" folder)
  • the local config file overrides the global config file (like the configuration in .Net with the machine.config and app.config/web.config). This is my favorite option.

I have experimented the second option in a fork :