为什么Find-Package不识别-ScriptSourceLocation参数?
PS H:\> help Find-Package -Full
NAME
Find-Package
SYNOPSIS
Finds software packages in available package sources.
SYNTAX
Find-Package [[-Name] <String[]>] [-AcceptLicense] [-AllowPrereleaseVersions] [-AllVersions] [-Command <String[]>] [-Credential <PSCredential>]
[-DscResource <String[]>] [-Filter <String>] [-Force] [-ForceBootstrap] [-IncludeDependencies] [-Includes {Cmdlet | DscResource | Function |
RoleCapability | Workflow}] [-MaximumVersion <String>] [-MinimumVersion <String>] [-PackageManagementProvider <String>] [-ProviderName {Bootstrap |
NuGet | PowerShellGet}] [-Proxy <Uri>] [-ProxyCredential <PSCredential>] [-PublishLocation <String>] [-RequiredVersion <String>] [-RoleCapability
<String[]>] [-ScriptPublishLocation <String>] ***[-ScriptSourceLocation <String>]*** [-Source <String[]>] [-Tag <String[]>] [-Type {Module | Script | All}]
[<CommonParameters>]但是,如果使用异常,则会产生异常。
PS H:\> Find-Package -ProviderName 'NuGet' -ScriptSourceLocation 'https://www.powershellgallery.com/api/v2/items/psscript'
Find-Package : A parameter cannot be found that matches parameter name 'ScriptSourceLocation'.
At line:1 char:36
+ Find-Package -ProviderName 'NuGet' -ScriptSourceLocation 'https://www ...
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Find-Package], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage发布于 2019-12-24 22:03:32
我认为您在这里看到的是一个bug,无论是使用Find-Package,还是可能是一些带有命名参数集的奇怪/错误。我会在Powershell核心问题页上报告这一点,因为它看起来仍然是当前版本的PowerShell 6的一个问题。进一步的测试表明,如果您不指定-ProviderName,那么这个参数可以正常工作,并且是可以识别的。
https://stackoverflow.com/questions/59472531
复制相似问题