【发布时间】:2020-09-12 03:21:49
【问题描述】:
我正在尝试在 PowerShell 7 中的 Linux 上设置 NuGet 包提供程序,以便我可以使用Install-Package 从 NuGet 库获取包。但是,当我运行时:
Install-PackageProvider -Name NuGet -Force
我收到以下错误:
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.
我做了一些搜索,从这个站点和其他发生此错误的站点中发现了一些问题,一些答案说我需要强制 TLS 1.2:
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
有人说要在Install-PackageSource 上指定-RequiredVersion,有人说要使用-ForceBootstrap,还有人说要使用-Force。这些都不起作用,我每次仍然遇到相同的错误。 Get-PackageProvider 将 NuGet 列为提供程序。
我也无法使用 PowerShell Core 在 Windows 上安装 NuGet 提供程序,但出现了同样的错误。这只是 PowerShell Core 不支持吗?
【问题讨论】:
标签: nuget powershell-core