Nuget package sources: global nuget.config for VS2019?

Viewed 4643

My organization is just getting started with using github, and we're trying to convert our internally developed dependencies into Github nuget packages from private repos. I first attempted to add our package feed into package sources using Tools | Options | NuGet Package Manager | Package Sources. However I didn't see anywhere to put in credentials, so as I expected, I got nothing but 401's from the Nuget UI.

My next attempt was creating a nuget.config file within my project, as per https://help.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-dotnet-cli-for-use-with-github-packages. THAT worked like a charm.

However, my aim here is to set up a global package source, for any solution I create, to access these internal dependencies without needing to add that config file to every new project.

So... is there a global nuget.config, or similar that visual studio uses for the nuget UI, that where I can append my private package source?

Thanks.

1 Answers

So... is there a global nuget.config, or similar that visual studio uses for the nuget UI, that where I can append my private package source?

Visual Studio has a global nuget.config file exits under %appdata%\NuGet\NuGet.Config and in my side, it is C:\Users\xxxx\AppData\Roaming\NuGet\NuGet.Config.

Then you can set your settings in this file and can be used directly in a project.

You can check this official document.

enter image description here

Note that: it can be overridden by the nuget.config file in your project.

Related