Download NuGet packages from PowerShell

Most of you have probably used the PowerShell Package Management cmdlets to download modules from the PowerShell Gallery. Some may even have used it to download software from Chocolatey. In this blog post I’m going to show you how to configure it to be able to download packages from NuGet.

First we need to install the NuGet package provider. Open PowerShell with administrative privileges, and type in the following command:

Find-PackageProvider -Name NuGet | Install-PackageProvider -Force

Then we need to register the package source:

Register-PackageSource -Name nuget.org -Location https://www.nuget.org/api/v2 -ProviderName NuGet

That’s it! You are now ready to download packages from NuGet. To search for packages, you can specify NuGet as the provider name when using the Find-Packages cmdlet:

Find-Package -Name <package name> -ProviderName NuGet

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s