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.93k stars 1.42k forks source link

Commands referencing packages that share an Id often throw the error message "No installed package found matching input criteria" #3750

Open fossbrandon opened 11 months ago

fossbrandon commented 11 months ago

Brief description of your issue

When upgrading programs that share an Id (ex: PostgreSQL.PostgreSQL and Microsoft.DotNet.SDK.6), the upgrade fails with an error message of No installed package found matching input criteria. Other commands such as uninstall can also fail when referencing packages by name. Them sharing an Id is an observation on my end for the packages that continually fail to perform winget actions, but this could be a larger issue or package specific issues.

Steps to reproduce

Install PostgreSQL 11 and PostgreSQL 15. Run winget upgrade to view that there are two entries for postgresql updates that both point to the latest version (16 at the time of writing this).

Expected behavior

I would expect that if I reference one of the available postgresql versions by their names during a command (ex: winget upgrade --name "PostgreSQL 11), that it would install PostgreSQL 16 and that the "available" upgrades for PostgreSQL 11 and PostgreSQL 15 would not appear anymore. I would also expect that winget upgrade --id "PostgreSQL.PostgreSQL", winget upgrade --name "PostgreSQL 11", and winget upgrade --name "PostgreSQL 15" would all succeed regardless of which one I ran whether I reference them by name or Id.

Actual behavior

References to the Id work for upgrades but references to the package name only sometimes work. Also, after upgrading to PostgreSQL 16, winget upgrade still shows the other postgresql versions as having an "available" upgrade but fail to "upgrade" when I try again. I'll list the steps for testing that I went through to verify that below:

I started with only versions 11 and 15 of PostgreSQL installed.

Listing available upgrades:

> winget upgrade
Name                                                               Id                           Version       Available     Source
----------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 11                                                      PostgreSQL.PostgreSQL        11            16.0          winget
PostgreSQL 15                                                      PostgreSQL.PostgreSQL        15            16.0          winget

Trying to update PostgreSQL 11 specifically by name (fails):

> winget upgrade --name "PostgreSQL 11"
No installed package found matching input criteria.

Trying to update PostgreSQL 15 specifically by name (succeeds):

> winget upgrade --name "PostgreSQL 15"
Found PostgreSQL 16 [PostgreSQL.PostgreSQL] Version 16.0
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Successfully verified installer hash
Starting package install...
Successfully installed

Note: I uninstalled PostgreSQL 16 before the next step but I had to do it through the windows GUI under Add or remove programs since if I tried to do it via winget with the command winget uninstall --name "PostgreSQL 16", it failed with the error No installed package found matching input criteria..

Trying to update postgresql via the Id PostgreSQL.PostgreSQL (succeeds):

> winget upgrade --id "PostgreSQL.PostgreSQL"
Found PostgreSQL 16 [PostgreSQL.PostgreSQL] Version 16.0
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://get.enterprisedb.com/postgresql/postgresql-16.0-1-windows-x64.exe
  ██████████████████████████████   391 MB /  391 MB
Successfully verified installer hash
Starting package install...
Successfully installed

Even though PostgreSQL 16 is installed now, winget upgrade still lists the previous PostgreSQL versions as needing an upgrade. If I run any of the upgrade commands above again, they all display the error No installed package found matching input criteria.

> winget upgrade
Name                                                               Id                           Version       Available     Source
----------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 11                                                      PostgreSQL.PostgreSQL        11            16.0          winget
PostgreSQL 15                                                      PostgreSQL.PostgreSQL        15            16.0          winget
>
> winget upgrade --name "PostgreSQL 11"
No installed package found matching input criteria.
>
> winget upgrade --name "PostgreSQL 15"
No installed package found matching input criteria.
>
> winget upgrade --id "PostgreSQL.PostgreSQL"
No installed package found matching input criteria.

Environment

`Windows Package Manager v1.6.2771`
`Windows: Windows.Desktop v10.0.22621.2283`
`Package: Microsoft.DesktopAppInstaller v1.21.2771.0`

**Note:** This is the output from `winget --info` but I do have Windows 11, not 10 so I'm not sure why it shows 10 as my desktop version.
denelon commented 11 months ago

Related to:

SuperBartimus commented 11 months ago

I'm seeing similarly:

 winget upgrade --include-unknown
Name                                                   Id                            Version        Available     Source
------------------------------------------------------------------------------------------------------------------------
Google Chrome                                          Google.Chrome                 117.0.5938.150 118.0.5993.71 winget
Windows Terminal                                       Microsoft.WindowsTerminal     1.18.2681.0    1.18.2822.0   winget
OBS Studio                                             OBSProject.OBSStudio          29.0.2         29.1.3        winget
Google Chrome                                          Google.Chrome                 117.0.5938.150 118.0.5993.71 winget
Microsoft ASP.NET Core 3.1.32 - Shared Framework (x64) Microsoft.DotNet.AspNetCore.6 < 6.0.5        6.0.23        winget
5 upgrades available. 

I then perform:

Winget upgrade --disable-interactivity --force --id google.chrome
Found Google Chrome [Google.Chrome] Version 118.0.5993.71
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://dl.google.com/dl/chrome/install/googlechromestandaloneenterprise64.msi
  ██████████████████████████████   103 MB /  103 MB
Successfully verified installer hash
Starting package install...
Successfully installed

and then going back to:

winget upgrade --include-unknown
Name                                                   Id                            Version        Available     Source
------------------------------------------------------------------------------------------------------------------------
Google Chrome                                          Google.Chrome                 117.0.5938.150 118.0.5993.71 winget
Windows Terminal                                       Microsoft.WindowsTerminal     1.18.2681.0    1.18.2822.0   winget
OBS Studio                                             OBSProject.OBSStudio          29.0.2         29.1.3        winget
Microsoft ASP.NET Core 3.1.32 - Shared Framework (x64) Microsoft.DotNet.AspNetCore.6 < 6.0.5        6.0.23        winget
4 upgrades available.

You can see it upgraded one of them. If I do the the upgrade command again, I get this:

Winget upgrade --disable-interactivity --force --id Google.Chrome
No available upgrade found.
No newer package versions are available from the configured sources.

And if I issue this command, this is the result:

Winget upgrade --disable-interactivity --force --name "Google Chrome"
Multiple installed packages found matching input criteria. Please refine the input.
Name          Id
---------------------------
Google Chrome Google.Chrome
Google Chrome Google.Chrome

... you can see the IDs are identical.

Using the --exact flag doesn't help. I'm also experiencing this issue with Microsoft.DotNet.AspNetCore.6