Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet - Install Package Programmatically (Multiple Sources)

Tags:

c#

nuget

The following article describes how to install packages programmatically:

http://blog.nuget.org/20130520/Play-with-packages.html

I have used one of the overloads to make sure it also installs the dependencies. However one of the dependencies for the pack I'm installing is not within the same source/feed.

Is it possible to specify multiple sources?

like image 908
nfplee Avatar asked Mar 13 '26 13:03

nfplee


1 Answers

I would create a PackageRepository for each of your package sources and then put them into an AggregateRepository. You can then use the AggregateRepository instead of the single IPackageRepository since it implements that interface.

The AggregateRepository takes a list of IPackageRepository in its constructor.

 public AggregateRepository(IEnumerable<IPackageRepository> repositories)
 {
 }
like image 73
Matt Ward Avatar answered Mar 16 '26 03:03

Matt Ward



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!