mpmackenna
mpmackenna

Reputation: 473

Unable to script installation of NuGet Package Provider in Powershell

I am trying to install the NuGet Package Provider using this command.

Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force

I've also tried adding the -Confirm:$false flag. I continue to be prompted for confirmation.

For example,

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"):

I want to complete this installation in a script. How can I bypass the confirmation prompt?

Upvotes: 4

Views: 5260

Answers (1)

mpmackenna
mpmackenna

Reputation: 473

This works to get the Nuget Package Provider installed without confirmation.

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

Upvotes: 1

Related Questions