OneGet / oneget

PackageManagement (aka OneGet) is a package manager for Windows
MIT License
2.38k stars 190 forks source link

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

Open andref15 opened 2 years ago

andref15 commented 2 years ago

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 :