Script to add nuget package source

We want to create a company nuget package repository. Is there a way to add a package source via the command line so that we can configure our new package source using configuration or something else?

Mostly we don’t want to go

Tools - Options - Package Manager - Package Sources - Plus Button - Add Name and Source

on all development machines in the company.

+8
nuget
source share
1 answer

Package sources are stored in NuGet.config in the user profile or system in ProgramData:

%AppData%\NuGet\NuGet.config %ProgramData%\NuGet\NuGetDefaults.config 

You can add package sources via NuGet using a command line similar to:

 nuget sources add -name FeedName -Source http://YourFeed.com 

The above command will work if you run it under the user profile.

NuGet 2.7 has implemented a system package source configuration in ProgramData. This way you can add your package sources to NuGet.config in ProgramData with your installer.

+15
source share

All Articles