Reputation: 454
I have a computer behind a proxy and trying to get the Nuget package provider installed. I ran Install-PackageProvider -Name Nuget on a different PC on a different network and copied Nuget folder to $env:ProgramFiles\PackageManagement\ProviderAssemblies.
If I run Get-PackageProvider -ListAvailable it shows Nuget available.
PS C:\Windows\system32> Get-PackageProvider -ListAvailable
Name Version DynamicOptions
---- ------- --------------
msi 3.0.0.0 AdditionalArguments
msu 3.0.0.0
nuget 2.8.5.204
PowerShellGet 1.0.0.1 PackageManagementProvider, Type, S...
Programs 3.0.0.0 IncludeWindowsInstaller, IncludeSy...
However when I try to run Import-PackageProvider -Name Nuget I get the following error:
PS C:\Windows\system32> Import-PackageProvider -Name Nuget
Import-PackageProvider : No match was found for the specified search criteria and provider name 'Nuget'. Try 'Get-PackageProvider -ListAvailable' to see if the provider exists on the system.At line:1 char:1
+ Import-PackageProvider -Name Nuget
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Nuget:String) [Import-PackageProvider], Exception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.ImportPackageProvider
Any suggestions? Thank you!
Upvotes: 1
Views: 11483
Reputation: 454
I was able to work around the proxy by using the following:
$wc = New-Object System.Net.WebClient
$wc.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
$wc.Proxy.Address = "http://proxyurl"
Once I did this I was able to use Install-PackageProvider Nuget to install the proivder.
Upvotes: 2