uninstallAll option for upgrade/install behavior
Description of the new feature / enhancement
Side by side installs are potentially one of the most frustrating experiences for users, especially when they result in an upgrade loop unintentionally. Adding onto this, many users do not realize that some packages are installed side by side, or may even have side-by-side installs before they started using winget.
We currently have the option within manifests to specify that the previous version should be uninstalled before the new version is installed. While this helps prevent upgrade loops in some cases, it doesn't break the loop if one exists. It would be extremely useful to have a way to remove all previous versions before installing the new one.
Proposed technical implementation details
I see a few options:
1 - Add uninstallAll to the upgradeBehavior, and uninstall all previous versions when installing the package
2a - Change the default behavior of uninstallPrevious to uninstall all previous versions of the package
2b - Make the behavior of uninstallPrevious configurable through a user setting
3 - Add a --prune argument to install and upgrade that uninstalls all previous versions before installing the package
I'm sure there are pros and cons to each, and further discussion would be needed as to which may be best
+1 for prune, it sounds like the best way to give the option to the user on if they want previous versions removed or not
Options for which I would vote for:
- 2a - Change the default behavior of
uninstallPreviousto uninstall all previous versions of the package - 3 - Add a
--pruneargument to install and upgrade that uninstalls all previous versions before installing the package