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