microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
22.5k stars 1.39k forks source link

`Get-WinGetPackage`'s `-Exact` option doesn't function #4561

Open wmmc88 opened 1 week ago

wmmc88 commented 1 week ago

Brief description of your issue

I'm getting different behavior between winget list -Exact and Get-WinGetPackage -Exact, and it looks like the -Exact option of Get-WinGetPackage is bugged. When -Exact is passed to Get-WinGetPackage, it is always returning nothing.

Steps to reproduce

🪟 Windows 11 Enterprise(10.0.22631) (pwsh) ~
at 08:12:16 PM ❯ winget list --id Microsoft.WindowsTerminal
Name                     Id                                Version      Source
-------------------------------------------------------------------------------
Windows Terminal         Microsoft.WindowsTerminal         1.20.11381.0 winget
Windows Terminal Preview Microsoft.WindowsTerminal.Preview 1.21.1382.0  winget

🪟 Windows 11 Enterprise(10.0.22631) (pwsh) ~
at 08:13:01 PM ❯ winget list --id Microsoft.WindowsTerminal --exact
Name             Id                        Version      Source
---------------------------------------------------------------
Windows Terminal Microsoft.WindowsTerminal 1.20.11381.0 winget

🪟 Windows 11 Enterprise(10.0.22631) (pwsh) ~
at 08:13:03 PM ❯ Get-WinGetPackage -Id Microsoft.WindowsTerminal -Source winget

Name                     Id                                Version      Available Source
----                     --                                -------      --------- ------
Windows Terminal         Microsoft.WindowsTerminal         1.20.11381.0           winget
Windows Terminal Preview Microsoft.WindowsTerminal.Preview 1.21.1382.0            winget

🪟 Windows 11 Enterprise(10.0.22631) (pwsh) ~
at 08:13:20 PM ❯ Get-WinGetPackage -Id Microsoft.WindowsTerminal -Source winget -Exact

Expected behavior

I expected the output of Get-WinGetPackage -Id Microsoft.WindowsTerminal -Source winget -Exact to match winget list --id Microsoft.WindowsTerminal --exact

Actual behavior

Get-WinGetPackage -Id Microsoft.WindowsTerminal -Source winget -Exact returns nothing

Environment

winget info:

Windows Package Manager v1.7.11261
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22631.3737
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.22.11261.0

Winget Directories
-----------------------------------------------------------------------------------------------------------------------
Logs                               %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Diag…
User Settings                      %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\sett…
Portable Links Directory (User)    %LOCALAPPDATA%\Microsoft\WinGet\Links
Portable Links Directory (Machine) C:\Program Files\WinGet\Links
Portable Package Root (User)       %LOCALAPPDATA%\Microsoft\WinGet\Packages
Portable Package Root              C:\Program Files\WinGet\Packages
Portable Package Root (x86)        C:\Program Files (x86)\WinGet\Packages
Installer Downloads                %USERPROFILE%\Downloads

Links
---------------------------------------------------------------------------
Privacy Statement   https://aka.ms/winget-privacy
License Agreement   https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage            https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale

Admin Setting                             State
--------------------------------------------------
LocalManifestFiles                        Disabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride                     Disabled
LocalArchiveMalwareScanOverride           Disabled

winget powershell module info:

Get-Module Microsoft.WinGet.Client

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     1.8.1133              Microsoft.WinGet.Client             {Add-WinGetSource, Assert-WinGetPackageManager, D…
github-actions[bot] commented 1 week ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

wmmc88 commented 1 week ago

It seems like the version of Microsoft.Winget.Client available in this repo, is not the same as what is published to PSGallery.

mdanish-kh commented 1 week ago

Get-WinGetPackage doesn't support an -Exact option. Try using -MatchOption Equals instead

 ~ Get-Help Get-WinGetPackage

NAME
    Get-WinGetPackage

SYNTAX
    Get-WinGetPackage [[-Query] <string[]>] [-Tag <string>] [-Command <string>] [-Count <uint>] [-Id <string>] [-Name <string>] [-Moniker <string>]
    [-Source <string>] [-MatchOption {Equals | EqualsCaseInsensitive | StartsWithCaseInsensitive | ContainsCaseInsensitive}] [<CommonParameters>]

ALIASES
    None

REMARKS
    None

As pointed out by the GitHub bot, this is related to:

[comment]: <[Policy] PowerShell> [comment]: <[Policy] Issue-Docs>

wmmc88 commented 1 week ago

It seems like the version of Microsoft.Winget.Client available in this repo, is not the same as what is published to PSGallery.

Is the updated source available somewhere?