I'm trying to set up the NuGet package provider on Linux in PowerShell 7 so I can useInstall-Package
to get a package from the NuGet Gallery. However, when I run:
Install-PackageProvider -Name NuGet -Force
I get the following error:
Install-PackageProvider: No match was found for the specified search criteria for the provider 'NuGet'.
The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified
package has the tags.
I did a bit of searching and found a few questions from this site and others where this error occurs, some answers saying I need to force TLS 1.2:
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
some saying to specify -RequiredVersion
on Install-PackageSource
, some saying to use-ForceBootstrap
, and some saying to use -Force
. None of these work and I'm still met with the same error each time. Get-PackageProvider
lists NuGet as a provider.
I'm was also unable to install the NuGet provider on Windows using PowerShell Core with the same error. Is this just not supported from PowerShell Core?
I also received this error and specifying the version (currently 3.0.0.1) also fails. What worked for me was piping the packageprovider into Install-PackageProvider
Get-PackageProvider | where name -eq 'nuget' | Install-PackageProvider
You may add -Force
if you want to avoid answering yes to The package(s) come(s) from a package source that is not marked as trusted. Are you sure you want to install software from ''?