Open Trenly opened 1 year ago
This also happens with packages within the same source - WinGet-2023-08-23-11-51-18.876.log
PS C:\WINDOWS\system32> winget search openjdk --verbose
Name Id Version Match Source
-------------------------------------------------------------------------------------------------------------
ojdkbuild OpenJDK ojdkbuild.ojdkbuild 1.8.3321.9 winget
Microsoft Build of OpenJDK with Hotspot 17 Microsoft.OpenJDK.17 17.0.8.7 Moniker: openjdk winget
Java SE Development Kit 20 Oracle.JDK.20 20.0.1.0 Tag: openjdk winget
Java SE Development Kit 18 Oracle.JDK.18 18.0.2.1 Tag: openjdk winget
Java SE Development Kit 17 Oracle.JDK.17 17.0.8.0 Tag: openjdk winget
ojdkbuild OpenJDK JRE 17 ojdkbuild.openjdk.17.jre 17.0030.6.1 Tag: openjdk winget
ojdkbuild OpenJDK 17 ojdkbuild.openjdk.17.jdk 17.0030.6.1 Tag: openjdk winget
OpenJDK JRE 11 ojdkbuild.openjdk.11.jre 11.0.15.1 Tag: openjdk winget
OpenJDK 11 ojdkbuild.openjdk.11.jdk 11.0.15.1 Tag: openjdk winget
<Results truncated for clarity>
WinGet-2023-08-23-11-51-36.391.log
PS C:\WINDOWS\system32> winget install openjdk --verbose
Multiple packages found matching input criteria. Please refine the input.
Name Id Source
----------------------------------------------------------------------
ojdkbuild OpenJDK ojdkbuild.ojdkbuild winget
Microsoft Build of OpenJDK with Hotspot 17 Microsoft.OpenJDK.17 winget
can confirm with edge
winget uninstall --name "Microsoft Edge" --disable-interactivity --exact --silent --accept-source-agreements.
ExitCode: -1978335210
Output: Multiple installed packages found matching input criteria. Please refine the input.
Name Id
-----------------------------------------------------------
Microsoft Edge Microsoft.Edge
Microsoft Edge Microsoft.MicrosoftEdge.Stable_8wekyb3d8bbwe
can confirm with edge
It looks like the issue you're having with edge is expected behavior and is not related to the moniker issue. Because you're using the uninstall command, the list of packages is specific to what is currently installed on your machine, not what is available in the source. It is possible to have both Microsoft.Edge
and Microsoft.MicrosoftEdge.Stable_8wekyb3d8bbwe
installed at the same time. You specifically used the --name
parameter and since both packages have the same name it cannot disambiguate between them. This is expected because both of them are an exact match. If you specify winget uninstall --id Microsoft.MicrosoftEdge.Stable_8wekyb3d8bbwe
it should be able to uninstall without issue.
I have a similar issue with the python3
moniker, even when specifying --exact --moniker
> winget install --exact --moniker python3
Multiple packages found matching input criteria. Please refine the input.
Name Id Source
-------------------------------------
Python 3.11 Python.Python.3.11 winget
Python 3.12 Python.Python.3.12 winget
Presumably this is because Python.Python.3.11 also has the python3.11
moniker which python3
partially matches.
Brief description of your issue
When attempting an install, winget tries to select the best package matching user intent. This is done by assessing for exact matches on Moniker, ID, Name, and in some cases (such as uninstall) product code. If an exact match is found, the package is assumed to be the user intent and is selected for install.
The logic for this appears to be broken ~when both the
msstore
source and thewinget
source are enabled.~Steps to reproduce
Running
winget search
will provide a list of the packages matched by the search and what field they were matched on if the match was not part of the name or package identifier.winget search
uses a substring match on the Name and Package identifier by default, but a case insensitive match on monikers, commands, tags, etc.The specific reproduction steps rely on the Google Chrome package. Running
winget search chrome
- WinGet-2023-08-23-10-23-37.093.logFrom the search, it is clear that the first two entries are substring matches on the Name, the third entry is an exact match on moniker and substring matches on the Name and Package Identifier, and so on and so forth. Each entry in the list can be correlated to a match type.
Running
winget install chrome
- WinGet-2023-08-23-10-24-04.956.logExpected behavior
Because the package
Google.Chrome
from thewinget
source had an exact match on moniker, and there were no exact matches on Name or Package Identifier from any source, theGoogle.Chrome
package should be selected for install.Actual behavior
Multiple packages are being found as matching user intent - the package
XP890QTFL1X0D0
from the msstore source, andGoogle.Chrome
from the winget source.Based on the results from
winget show
, the packageXP890QTFL1X0D0
is only a substring match on the package name, whereasGoogle.Chrome
is an exact match on the moniker. Because of the exact match on the moniker, this package should be selected for user intent above any substring matches on name or identifier.Environment