winget-cli
winget-cli copied to clipboard
Winget Import: If "multiple packages" found - exits early, even if other packages left
Brief description of your issue
Fresh install - tried to restore a winget export
json from my old PC.
It worked, until it encountered a couple VC++ Redistributables, citing Multiple packages found matching input criteria. Please refine the input.
It also seems to have given up on a bunch of packages before the VC++ (as well as after).
This is my main issue.
Steps to reproduce
Prerequisites- dont have the packages in the json installed.
- In powershell, run
winget import
on the manifest given (backup_winget_bug.json
) - outputs the following:
No applicable update found.
Multiple packages found matching input criteria. Please refine the input.
Name Id Source
----------------------------------------------------------------------------------------------------
Microsoft Visual C++ 2015-2019 Redistributable (x64) Microsoft.VC++2015-2019Redist-x64 winget
Microsoft Visual C++ 2015-2019 Redistributable (x86) … {38b2c744-ad08-4d5b-91a2-3fb6f739ff3e}
Package not found for import: Microsoft.VC++2015-2019Redist-x64
Multiple packages found matching input criteria. Please refine the input.
Name Id Source
----------------------------------------------------------------------------------------------------
Microsoft Visual C++ 2015-2019 Redistributable (x86) Microsoft.VC++2015-2019Redist-x86 winget
Microsoft Visual C++ 2015-2019 Redistributable (x86) … {38b2c744-ad08-4d5b-91a2-3fb6f739ff3e}
Package not found for import: Microsoft.VC++2015-2019Redist-x86```
[winget_import_bug.zip](https://github.com/microsoft/winget-cli/files/7006734/winget_import_bug.zip)
- Run the other manifest (
backup_winget_works_reference.json
), that doesn't have VC++ redists in it - works fine
Expected behavior
- Installer should not exit early because of ambiguous packages, instead outputting to stderr but trying to install the rest of the list
- generally - export and import Should be symmetric. Packages exported with
winget export
should always work when importing them withwinget import
. Meaning either the export should be more specific, or if there was enough metadata, the import should be able to handle this case. - There should probably be an
--exact
/-e
flag similar towinget install
Actual behavior
Installer exits early, and skips a bunch of packages
Environment
Windows Package Manager v1.0.11692 Copyright (c) Microsoft Corporation. All rights reserved.
Windows: Windows.Desktop v10.0.19043.1165 Package: Microsoft.DesktopAppInstaller v1.12.11692.0
Attached jsons
Does this still happen in Windows Package Manager 1.3?
@JonLevin25 this issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.
I tried this again now, but could not test due to #2569
It's a similar thing of winget import
exiting early, but removing just the VCRedists did not fix it.
Perhaps this is an overarching issue of individual package installs not being isolated enough within the importer, or the importer not continuing when (any kind of) installation error occurs?
@JonLevin25 that seems like a decent hypothesis. We will have to trace down what is happening.
@JonLevin25 We've just released WinGet 1.4 with several enhancements to the install flow. Can you verify if the problem reported here is still happening?
The "install" flow is now looking to see if the package is already installed. If it is, the flow can switch to the upgrade behavior which addresses packages requiring specific switches for upgrade. We've also added checks around "sets" of operations to attempt to continue when a single error is encountered.
So I think this is fixed, though I couldn't check on a PC that doesn't have most packages, so most or all installs were no-ops.
Still, I think this bug used to repro in that situation.
This was my output
winget import .\backup_winget_bug.json Found an existing package already installed. Trying to upgrade the installed package... No package found matching input criteria. Package not found for import: Python.Python.3 Found an existing package already installed. Trying to upgrade the installed package... Found an existing package already installed. Trying to upgrade the installed package... No package found matching input criteria. Package not found for import: Microsoft.VC++2008Redist-x64 No package found matching input criteria. Package not found for import: Microsoft.VC++2015-2019Redist-x64 Found an existing package already installed. Trying to upgrade the installed package... No applicable upgrade found. Package is already installed: Microsoft.VisualStudioCode No package found matching input criteria. Package not found for import: Microsoft.VC++2008Redist-x86 Found an existing package already installed. Trying to upgrade the installed package... A newer version was found, but the install technology is different from the current version installed. Please uninstall the package and install the newer version. Package is already installed: Microsoft.PowerShell No package found matching input criteria. Package not found for import: UnityTechnologies.UnityHub No package found matching input criteria. Package not found for import: Microsoft.VC++2015-2019Redist-x86
Python.Python.3 was refactored into minor versions. The VC++ Redistributables were also refactored by architecture and the shape of the package identifiers also changed. PowerShell changed their installer technology.
I updated:
- https://github.com/microsoft/winget-cli/issues/1924
It was originally just for architecture, but after looking at the output above, we clearly need to improve the output so users know what's going on.
I'm going to go ahead and close this Issue. Feel free to reopen or ping me if it's not resolved.