Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find-Package does not find packages without wildcard character #521

Open
andref15 opened this issue May 22, 2022 · 0 comments
Open

Find-Package does not find packages without wildcard character #521

andref15 opened this issue May 22, 2022 · 0 comments

Comments

@andref15
Copy link

Steps to reproduce

When searching for a NuGet Package with the Find-Package command no packages are found unless you add a wildcard character to the value of the name parameter.
Find-Package -Name PackageName -Source Test -Credential (Get-Credential) does not work but
Find-Package -Name PackageName* -Source Test -Credential (Get-Credential) does

The problem with this behavior is that it's not possible to find a package by the exact name, so a package called PackageName123 would also be returned and it also is not possible to combine a wildcard search with the AllVersions flag

Expected behavior

PS> Find-Package -Name PackageName -Source Test -Credential (Get-Credential)
Name                           Version          Source           Summary
----                           -------          ------           -------
PackageName                    1.0.0            Test             Package Description

Actual behavior

PS> Find-Package -Name PackageName -Source Test -Credential (Get-Credential)
Find-Package: No match was found for the specified search criteria and package name 'STYX.Blazor.UI.Attribute'. Try Get-PackageSource to see all available registered package sources.

PS> Find-Package -Name PackageName* -Source Test -Credential (Get-Credential)
Name                           Version          Source           Summary
----                           -------          ------           -------
PackageName                    1.0.0            Test             Package Description

Error details

PS> Get-Error

Exception             :
    Type    : System.Exception
    Message : No match was found for the specified search criteria and package name 'PackageName'. Try Get-PackageSource to see all available
registered package sources.
    HResult : -2146233088
TargetObject          : Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage
CategoryInfo          : ObjectNotFound: (Microsoft.PowerShel…Cmdlets.FindPackage:FindPackage) [Find-Package], Exception
FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage
InvocationInfo        :
    MyCommand        : Find-Package
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 7
    Line             : Find-Package -Name PackageName -Source Test -Credential (Get-Credential)
    PositionMessage  : At line:1 char:1
                       + Find-Package -Name PackageName -Source Test -Credential …
                       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : Find-Package
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant