无法在Powershell中安装NuGet包提供程序的脚本

时间:2017-07-17 18:38:25

标签: powershell nuget

我正在尝试使用此命令安装NuGet Package Provider。

Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force

我也尝试添加-Confirm:$false标志。我继续被提示确认。

例如,

NuGet provider is required to continue
PowerShellGet requires NuGet provider version '2.8.5.201' or newer to 
interact with NuGet-based repositories. The NuGet
provider must be available in 'C:\Program 
Files\PackageManagement\ProviderAssemblies' or
'C:\Users\Booker\AppData\Local\PackageManagement\ProviderAssemblies'. You 
can also install the NuGet provider by
running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -
Force'. Do you want PowerShellGet to install
and import the NuGet provider now?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"):

我想在脚本中完成此安装。如何绕过确认提示?

1 个答案:

答案 0 :(得分:1)

这可以在未确认的情况下安装Nuget软件包提供程序。

Find-PackageProvider -Name 'Nuget' -ForceBootstrap -IncludeDependencies