Unable to install NuGet with Install-PackageProvider
Following these instructions: https://docs.microsoft.com/en-us/powershell/scripting/gallery/installing-psget?view=powershell-7.1#get-the-latest-version-from-powershell-gallery
This command:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-PackageProvider -Name 'NuGet' -Source 'PSGallery' -Scope 'CurrentUser' -Verbose
Fails with:
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.
Also, this command:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Find-PackageProvider -Name 'NuGet' -Source 'PSGallery' -AllVersions -Verbose
Fails with:
VERBOSE: Repository details, Name = 'PSGallery', Location = 'https://www.powershellgallery.com/api/v2'; IsTrusted = 'True'; IsRegistered = 'True'.
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
VERBOSE: Using the specified source names : 'PSGallery'.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2' and PackageManagementProvider is 'NuGet'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='NuGet'' for ''.
VERBOSE: Total package yield:'3' for the specified package 'NuGet'.
Find-PackageProvider: No match was found for the specified search criteria and package name 'NuGet'. Try Get-PackageSource to see all available registered package sources.
When searching for these tags, NuGet does not show up in the result: https://www.powershellgallery.com/packages?q=Tags%3A%22PackageManagement%22%2C%22Provider%22
What am I missing?
This sounds like the same issue as described in #86, but the fix ([Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12) does not work - at least not for me.
Same issue here. Any updates?
Can you check which version of PowerShellGet and PackageManagement you are using:
gmo "PowerShellGet", "PackageManagement" -ListAvailable
this might be related to having older versions of either..if you don't have the latest version you can try updating both by doing:
Update-Module "PowerShellGet" -RequiredVersion "2.2.5"
Directory: C:\program files\powershell\7\Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 1.4.7 PackageManagement Desk {Find-Package, Get-Package, Get-Package…
Script 2.2.5 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-M…
Also:
PS> Update-Module "PowerShellGet" -RequiredVersion "2.2.5"
Update-Module: Module 'PowerShellGet' was not installed by using Install-Module, so it cannot be updated.
Is there any resolution to this issue?
@jboarman can you please provide your environment information including PowerShellGet, PackageManagement, PowerShell, and NuGet version (nuget.exe help)? this is not necessarily a known issue so well need more info on what you are seeing-- thanks 😄
I've got this working in PS5, not PS7 on the same pc:
Powershell 5
find-packageprovider -name "NuGet" -verbose
VERBOSE: Acquiring providers for assembly:
C:\Users\paul\OneDrive\Documents\WindowsPowerShell\Modules\PackageManagement\1.4.8.1\fullclr\Microsoft.PackageManagemen
t.MsuProvider.dll
VERBOSE: Acquiring providers for assembly:
C:\Users\paul\OneDrive\Documents\WindowsPowerShell\Modules\PackageManagement\1.4.8.1\fullclr\Microsoft.PackageManagemen
t.NuGetProvider.dll
VERBOSE: Acquiring providers for assembly:
C:\Users\paul\OneDrive\Documents\WindowsPowerShell\Modules\PackageManagement\1.4.8.1\fullclr\Microsoft.PackageManagemen
t.MsiProvider.dll
VERBOSE: Acquiring providers for assembly:
C:\Users\paul\OneDrive\Documents\WindowsPowerShell\Modules\PackageManagement\1.4.8.1\fullclr\Microsoft.PackageManagemen
t.MetaProvider.PowerShell.dll
VERBOSE: Acquiring providers for assembly:
C:\Users\paul\OneDrive\Documents\WindowsPowerShell\Modules\PackageManagement\1.4.8.1\fullclr\Microsoft.PackageManagemen
t.CoreProviders.dll
VERBOSE: Acquiring providers for assembly:
C:\Users\paul\OneDrive\Documents\WindowsPowerShell\Modules\PackageManagement\1.4.8.1\fullclr\Microsoft.PackageManagemen
t.ArchiverProviders.dll
VERBOSE: Using the provider 'Bootstrap' for searching packages.
VERBOSE: Finding the package 'Bootstrap::FindPackage' 'NuGet','','','''.
Name Version Source Summary
---- ------- ------ -------
nuget 2.8.5.208 https://onege... NuGet provider for the OneGet meta-package manager
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
VERBOSE: The -Repository parameter was not specified. PowerShellGet will use all of the registered repositories.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'https://www.poshtestgallery.com/api/v2/' and PackageManagementProvider is 'NuGet'.
VERBOSE: Searching repository 'https://www.poshtestgallery.com/api/v2/FindPackagesById()?id='NuGet'' for ''.
VERBOSE: Total package yield:'0' for the specified package 'NuGet'.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2' and PackageManagementProvider is 'NuGet'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='NuGet'' for ''.
VERBOSE: Total package yield:'1' for the specified package 'NuGet'.
PS C:\Users\paul> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.22621.2506
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.2506
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Powershell 7:
find-packageprovider -name "NuGet" -verbose
VERBOSE: Using the provider 'Bootstrap' for searching packages.
VERBOSE: Finding the package 'Bootstrap::FindPackage' 'NuGet','','','''.
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
VERBOSE: The -Repository parameter was not specified. PowerShellGet will use all of the registered repositories.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'https://www.poshtestgallery.com/api/v2/' and PackageManagementProvider is 'NuGet'.
VERBOSE: Searching repository 'https://www.poshtestgallery.com/api/v2/FindPackagesById()?id='NuGet'' for ''.
VERBOSE: Total package yield:'0' for the specified package 'NuGet'.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2' and PackageManagementProvider is 'NuGet'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='NuGet'' for ''.
VERBOSE: Total package yield:'1' for the specified package 'NuGet'.
Find-PackageProvider: No match was found for the specified search criteria and package name 'NuGet'. Try Get-PackageSource to see all available registered package sources.
PS C:\Users\paul> $PSVersionTable
Name Value
---- -----
PSVersion 7.2.18
PSEdition Core
GitCommitId 7.2.18
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
On both Powershell Versions:
[Net.ServicePointManager]::SecurityProtocol
Tls12
PS5:
gmo "PowerShellGet", "PackageManagement" -ListAvailable
Directory: C:\Users\paul\OneDrive\Documents\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.4.8.1 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Script 2.2.5 PowerShellGet {Find-Command, Find-DSCResource, Find-Module, Find-RoleCap...
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.4.7 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Binary 1.0.0.1 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Script 2.2.4.1 PowerShellGet {Find-Command, Find-DSCResource, Find-Module, Find-RoleCap...
Script 1.0.0.1 PowerShellGet {Install-Module, Find-Module, Save-Module, Update-Module...}
PS7:
gmo "PowerShellGet", "PackageManagement" -ListAvailable
Directory: C:\program files\powershell\7\Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 1.4.7 PackageManagement Desk {Find-Package, Get-Package, Get-Package…
Script 2.2.5 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-M…
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 1.4.7 PackageManagement Desk {Find-Package, Get-Package, Get-Package…
Binary 1.0.0.1 PackageManagement Desk {Find-Package, Get-Package, Get-Package…
Script 2.2.4.1 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-M…
Script 1.0.0.1 PowerShellGet Desk {Install-Module, Find-Module, Save-Modu…
Updated to latest PS7 and same result:
PS C:\Users\paul> $PSVersionTable
Name Value
---- -----
PSVersion 7.4.1
PSEdition Core
GitCommitId 7.4.1
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
PS C:\Users\paul> find-packageprovider -name "NuGet" -verbose
VERBOSE: Acquiring providers for assembly: C:\program files\powershell\7\Modules\PackageManagement\coreclr\netstandard2.0\Microsoft.PackageManagement.CoreProviders.dll
VERBOSE: Acquiring providers for assembly: C:\program files\powershell\7\Modules\PackageManagement\coreclr\netstandard2.0\Microsoft.PackageManagement.ArchiverProviders.dll
VERBOSE: Acquiring providers for assembly: C:\program files\powershell\7\Modules\PackageManagement\coreclr\netstandard2.0\Microsoft.PackageManagement.NuGetProvider.dll
VERBOSE: Acquiring providers for assembly: C:\program files\powershell\7\Modules\PackageManagement\coreclr\netstandard2.0\Microsoft.PackageManagement.MetaProvider.PowerShell.dll
VERBOSE: Using the provider 'Bootstrap' for searching packages.
VERBOSE: Finding the package 'Bootstrap::FindPackage' 'NuGet','','','''.
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
VERBOSE: The -Repository parameter was not specified. PowerShellGet will use all of the registered repositories.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2' and PackageManagementProvider is 'NuGet'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='NuGet'' for ''.
VERBOSE: Total package yield:'1' for the specified package 'NuGet'.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'https://www.poshtestgallery.com/api/v2/' and PackageManagementProvider is 'NuGet'.
VERBOSE: Searching repository 'https://www.poshtestgallery.com/api/v2/FindPackagesById()?id='NuGet'' for ''.
VERBOSE: Total package yield:'0' for the specified package 'NuGet'.
Find-PackageProvider: No match was found for the specified search criteria and package name 'NuGet'. Try Get-PackageSource to see all available registered package sources.
PS C:\Users\paul> gmo "PowerShellGet", "PackageManagement" -ListAvailable
Directory: C:\program files\powershell\7\Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 1.4.8.1 PackageManagement Desk {Find-Package, Get-Package, Get-Package…
Script 2.2.5 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-M…
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 1.4.7 PackageManagement Desk {Find-Package, Get-Package, Get-Package…
Binary 1.0.0.1 PackageManagement Desk {Find-Package, Get-Package, Get-Package…
Script 2.2.4.1 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-M…
Script 1.0.0.1 PowerShellGet Desk {Install-Module, Find-Module, Save-Modu…
PS C:\Users\paul> [Net.ServicePointManager]::SecurityProtocol
Tls12
@SydneyhSmith - I couldn't work out how to do my own build of the packagemanagement module and connect a debugger - I was wondering if I'm seeing an exception - or whether this is handled and not related:
Any resolution?
PowerShell 7:
"Install-PackageProvider -Name Nuget -Force"
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 never got a response back from @SydneyhSmith who i'd tried to ping - laptop i was hitting this on, ended up needing to be reset so not sure I can test further.