Sto seguendo Get Started with the PowerShell Gallery che indica che il modulo PowerShellGet esiste in Windows 10 (che sto usando - build 14721). Per confermare, io sono in esecuzione PowerShell v5:Install-PackageProvider non è riconosciuto come nome di un cmdlet, funzione, file di script o programma eseguibile
>$PSVersionTable
Name Value
---- -----
PSVersion 5.0.14271.1000
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14271.1000
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Get Started with the PowerShell Gallery stati:
PowerShellGet richiede anche il fornitore NuGet di lavorare con la Galleria PowerShell. Verrà richiesto di installare il provider NuGet automaticamente al primo utilizzo di PowerShellGet se il provider NuGet non si trova in uno dei seguenti percorsi: • $ env: ProgramFiles \ PackageManagement \ ProviderAssemblies
• $ env: LOCALAPPDATA \ PackageManagement \ ProviderAssemblies
non ho nulla in quei luoghi:
>ls $env:LOCALAPPDATA\PackageManagement\ProviderAssemblies
>ls $env:ProgramFiles\PackageManagement\ProviderAssemblies
ls : Cannot find path 'C:\Program Files\PackageManagement\ProviderAssemblies' because it does not exist.
At line:1 char:1
+ ls $env:ProgramFiles\PackageManagement\ProviderAssemblies
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\Program File...viderAssemblies:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
Get Started with the PowerShell Gallery poi afferma:
Oppure, è possibile eseguire Install-PackageProvider -Name NuGet -Force per automatizzare il download e l'installazione del provider NuGet.
Se provo che:
>Install-PackageProvider -Name NuGet -Force
Install-PackageProvider : The term 'Install-PackageProvider' is not recognized as the name of a cmdlet, function, script file, or operable program.
correct and try again.
At line:1 char:1
+ Install-PackageProvider -Name NuGet -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Install-PackageProvider:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Sono molto confuso. Ho PowerShell v5 ma sembra che non ho tutto ciò che dovrebbe essere lì, vale a dire PowerShellGet.
Qualcuno può spiegare perché?
Si sta eseguendo la console di PowerShell come amministratore? Per impostazione predefinita, credo che la console PS o ISE venga eseguita come utente limitato. Prova a fare clic con il pulsante destro del mouse su PowerShell dal menu Start e scegli Esegui come amministratore. – user4317867
Appena provato a eseguire "Install-PackageProvider -Name NuGet -Force" come admin, stesso risultato :( – jamiet
Il titolo della tua console PS dice "Amministratore:"? Inoltre, hai controllato https://technet.microsoft.com/ us/library/mt676543.aspx e ho provato ad utilizzare 'Get-PackageProvider -ListAvailable' quando provo in PS v5 su Win 7, ricevo un errore che indica che ListAvailable non è un parametro riconosciuto – user4317867