Installing multiple packages via Nuget by single command

Question:

I am using Nuget via Visual Studio’s Package Manager Console. For every project I need to add few packages e.g. xunit.contribs, fluentassertions and nsubstitute. To do that I type 3 commands in consolle.

I understand that console is just another powershell host and there should be a way to create a script (kind of Add-Test-Stuff.ps1) that will add several packages at once. What is the best way to do that?

Answer:

I typically define my packages in arrays and execute them using a foreach loop

This can also be written as a one-liner

Source:

Installing multiple packages via Nuget by single command by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply