List user repositories

Mar 16, 2011 at 11:15 AM


First, this is a really good work you've done with Nuget.

Currently i'm using a template wizard to execute some code before project creation ends.

I'm using in this wizard the nuget visual studio assembly to install packages.

My question is : how to get repositories of the current user ( which appear in the package manage settings in visual studio).

Is there a way to get the path to the repository by using the name ?

Could be usefull in a case where source repository have to change.


Mar 16, 2011 at 6:25 PM
We write the package sources into the registry using the ShellSettingsManager class. 

You can get the to the collection by doing:

var settings = new ShellSettingsManager(serviceProvider);
string packageSources = settings.GetString("NuGet", "PackageSources", "");
It returns you the serialized string of List<PackageSource>.
Mar 17, 2011 at 8:52 AM