正如标题所述,我不能在nuget v3 url中使用Find-Package命令:
https://api.nuget.org/v3/index.json如果我运行命令:
Find-Package nuget.versioning -Source https://api.nuget.org/v3/index.json我发现一个没有找到匹配的错误。将命令更改为:
Find-Package nuget.versioning -Source https://www.nuget.org/api/v2效果很好。
我需要升级一些软件才能让它正常工作吗?我正在运行Powershell版本5,所以我不确定需要采取哪些步骤来解决这个问题。
发布于 2020-04-12 20:10:05
使用Powershell 5.1时,它会如您所描述的那样失败。但是使用PowerShell Core 7,它正确地工作:
PS> Find-Package nuget.versioning -Source https://api.nuget.org/v3/index.json -ProviderName NuGet
Name Version Source Summary
---- ------- ------ -------
NuGet.Versioning 4.6.4 nuget.org NuGet's implementation of Semantic Versioning.注意,您可以通过PowerShell变量检查您的PSVersionTable版本:
PS> $PSVersionTable
Name Value
---- -----
PSVersion 7.0.0
PSEdition Core
GitCommitId 7.0.0
OS Microsoft Windows 10.0.18362
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0在PowerShell核心7上,您将看到它使用NuGet包提供程序的版本3,因此它支持协议v3。
PS> Get-PackageProvider
Name Version DynamicOptions
---- ------- --------------
NuGet 3.0.0.1 Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate
PowerShellGet 2.2.3.0 PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPrereleaseVersions, Filter, Tag, Includes, DscResource, RoleCapability, Command, Accep…https://stackoverflow.com/questions/54367822
复制相似问题