Now that NuGet is fully understood by MSBuild, it’s time to look at how we can have a system-wide NuGet.config to contain all our NuGet repositories including private ones and commercial ones requiring a password. You can remove any NuGet.config files from our solutions.
Open Windows Explorer and enter %AppData%\Nuget into the address bar. It’ll open a folder with your system Nuget.config
Open this file in Notepad or Notepad++ (my favourite)
To add local NuGet servers, simply add them under packageSources if they have no authentication.
If they require a username and password or you wish to add commercial NuGet servers , we can add them to NuGet.config by running the following in a CMD prompt:
For example, if you want Telerik’s server, you would run:
NuGet.exe Sources Add -Name “telerik.com” -Source “https://nuget.telerik.com/nuget” -UserName “YourEmail@email.com” -Password “Your Password”
Your NuGet.config is updated :
To see the changes in Visual Studio, restart it.
If your build server restores NuGet, add this file to the server folder: %ProgramFiles(x86)%\NuGet\Config