Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scripted way to add nuget package source

Tags:

nuget

We want to start a company nuget package repository. Is there a way to add a package source through command line so we can configure our new package source through a setup or something?

We basically don't want to go

Tools - Options - Package Manager - Package Sources - Plus button - add name and source

on every developer machine in the company.

like image 404
Boris Callens Avatar asked Sep 25 '13 09:09

Boris Callens


1 Answers

The package sources are stored in NuGet.config under the user's profile or system wide in ProgramData:

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

You can add package sources through 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's profile.

NuGet 2.7 introduced system wide package source configuration in ProgramData. So you could add your package sources into NuGet.config under ProgramData with your installer.

like image 166
Matt Ward Avatar answered Oct 13 '22 03:10

Matt Ward