Powershell查找程序包命令没有';无法使用nuget v3包源代码

Powershell查找程序包命令没有';无法使用nuget v3包源代码,powershell,nuget,nugetgallery,Powershell,Nuget,Nugetgallery,正如标题所述,我无法将Find Package命令与nuget v3 url一起使用: 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/a

正如标题所述,我无法将Find Package命令与nuget v3 url一起使用:

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,因此我不确定需要采取哪些步骤来修复此问题。

对于Powershell 5.1,它会如您所述失败。但使用PowerShellCore7,它可以正常工作:

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.
请注意,您可以通过
PSVersionTable
变量检查PowerShell版本:

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 Core 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…

我相信在
PackageManagement
模块中有一个解决方案。您可以尝试更新它,但我记得附带的模块不支持v3nuget。