Ben*_*est 8 nuget powershell-core
我正在尝试在 Linux 上的 PowerShell 7 中设置 NuGet 包提供程序,以便我可以用来Install-Package从 NuGet Gallery 获取包。但是,当我运行时:
Install-PackageProvider -Name NuGet -Force
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
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.
Run Code Online (Sandbox Code Playgroud)
我做了一些搜索,发现这个网站和其他网站上出现了这个错误的一些问题,一些答案说我需要强制 TLS 1.2:
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
Run Code Online (Sandbox Code Playgroud)
有的说指定-RequiredVersion,Install-PackageSource有的说使用-ForceBootstrap,有的说使用-Force。这些都不起作用,我每次仍然遇到同样的错误。Get-PackageProvider将 NuGet 列为提供程序。
我也无法使用 PowerShell Core 在 Windows 上安装 NuGet 提供程序,并出现相同的错误。PowerShell Core 是否不支持此功能?
我也收到此错误并且指定版本(当前为 3.0.0.1)也失败。对我有用的是将 packageprovider 通过管道传输到Install-PackageProvider
Get-PackageProvider | where name -eq 'nuget' | Install-PackageProvider
Run Code Online (Sandbox Code Playgroud)
-Force如果您想避免回答“是”,您可以添加The package(s) come(s) from a package source that is not marked as trusted. Are you sure you want to install software from ''?
| 归档时间: |
|
| 查看次数: |
9741 次 |
| 最近记录: |