-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
winget should not install an already installed package #929
Comments
There may be cases where a subsequent install is intentional. A user might be attempting a downgrade scenario. We might also prompt "Did you want to upgrade?" or something like that as well. |
Can we add option reinstall or flag --force?
|
We should notify the user that the package is already installed and inform them it's possible to use "upgrade". We will still likely keep the |
How about: The current version is installed on the system:
An upgrade is available:
We could optionally add a setting for the default behavior. The default setting would be to perform the upgrade, users could also specify not automatically running the upgrade. In that case, the user would be informed an upgrade is available, but they would need to run the upgrade command themselves in that case:
|
I like this one. makes more sense |
We could have three settings "automatic-upgrade", "inform-only", and "prompt" which could give a [Y] | [N] option for the upgrade. Note this would also be impacted by the future work for package pinning. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
+1 here. My scenario: I'm creating my own windows
The thing is, Docker may require a restart, which breaks blocks My script is meant to install, not upgrade the components. To upgrade I already have These are the semantics that feel natural to me and would allow me to script my environment:
|
this seems like the best solution to me.
in before "you can use a combination of winget list, winget upgrade and winget install in a script to achieve this already' |
…es to winget install and winget upgrade flow.md
…es to winget install and winget upgrade flow.md
…es to winget install and winget upgrade flow.md
Just in case somebody needs a workaround for a script:
Change it to your wanted app. Of course it would be way better if winget had a simple flag or command to avoid such mess 😉 |
It is possible to get the "file version" from an .exe, but that doesn't always correlate to the registry entries that are used to display package versions in Windows Apps & Features. That could also lead to other unintended consequences when the package does decide to write something to the registry. There are also cases where there is a "marketing version" for a product that publishers prefer to display to users. Sometimes a program will also display a different version itself than the file version. There are just too many edge cases that lead to unreliable or confusing behavior for users which is why we defer to the version reported to Windows Apps & Features, and we allow a different "marketing version" to be displayed in the manifest than the version reported in the registry. The .NET packages are a perfect example of that use case as well. |
in my opinion the moment an app is installed with winget (just like choco) a version is stored either in a manifest file or in the registry so that the next time winget will parse the app version prior to decide what to do with the install option |
The issue with that is it doesnt take into account anything that may happen outside of winget between runs, meaning things can get out of sync quite fast depending on the installed apps and their hastiness of automatically updating or users not bothering to use winget and just updating something manually. It would basically lock people into only using winget or never having winget work correctly |
In a way, it already does that @besmirzanaj. When you install a store app, the store has its's own registry. If it is a winget manifest, then is tracked in the "Add/Remove Programs" windows registry. I think there is no technical barrier preventing to implement this. The problem is the different visions & expectations of what each command should do between previous version and users coming from different ecosystems, including former winget versions. @yao-msft can we take a look at the new spec? |
TLDR; If you call That should also be able to honor the pinning feature currently in progress: Adding "--force" will essentially force the install flow rather than switching to the upgrade flow. |
That's disappointing. Wasn't this issue about how I already explained myself in this comment? |
Muscle memory seems to be driving this behavior more than anything else. I'd like to help people fall into the "pit of success" here. If a user is asking for a thing to be installed, and the latest version is present (or in the future, the pinned version is present) then it would essentially be a "no-op". If the package isn't pinned, and it's an "older" version, then the action would be upgrade. We could certainly consider a setting to change the behavior. A user could essentially say "I don't want an upgrade if any version of a package is installed and I try to install it again", but the default would be if a user tries to install an existing package, WinGet would upgrade it. |
If we had such a "setting", then it makes sense to also have an argument that could override the default behavior or the behavior in a user's settings. |
A setting is persistent, which is not really script-friendly, or at least a second class citizen. Would force me to do I may settle with an argument like
|
I like the idea of following prior art to avoid some muscle memory confusion "--no-upgrade" makes sense as an argument to "override" settings if they are different in my opinion. |
i dont get why reinvent the wheel. currently checking each package before installing... |
Description of the new feature/enhancement
winget should check if an application is already installed before it runs the installer
Proposed technical implementation details (optional)
check for installed software (could be a registry key) before you run the install command.
example: if the
winget install <software>
is run once, then the next time it runs, it should prompt that the<software>
is already installed and not proceed to reinstall it again.Current implementation will reinstall the software over and over:
The text was updated successfully, but these errors were encountered: