winget-cli: Already installed app are not detected
Brief description of your issue
Have installed Windows Terminal latest version and when run winget install “Windows Terminal” it gets installed again and don’t detect that it was already installed.
Steps to reproduce
run winget install for a application that you have already installed with same version.
Expected behavior
Detect that app already is installed and give option to abort or overwrite. or text that you have to use extra parameter to overwrite.
Actual behavior
Environment
[winget --info]
Windows Package Manager v0.1.41331 Preview
Copyright (c) Microsoft Corporation. All rights reserved.
Windows: Windows.Desktop v10.0.19628.1
Package: Microsoft.DesktopAppInstaller v1.0.41331.0
Any other software?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 59
- Comments: 17 (4 by maintainers)
I think for the sake of batch scripts it should have a toggle that can be put at the start to skip already installed packages. example winget --skipInstalled
I agree there might be cases where I want to repair an installation. However, in general I believe I want to install stuff and in case it is already installed it should just be skipped. Indeed I was talking about
winget install
rather thanwinget upgrade
.I’m finding that winget is both really powerful - as all package managers are - but also this particular issue makes it quite impossible to script and manage an estate using scripts with winget to for example install applications and if they are installed to skip the installations. This is particularly visible with MS Teams which will force-close when installing, which you wouldn’t want to force using InTune scripts because it would make MS Teams consistently unavailable for end-users.
I agree with josh-65; default behavior should do something logically and without user input. It can always output something afterwards, like
you already have version 4.1 installed, installing 4.latest
If it’s already installed the default behaviour should be to re-install over the top, or uninstall/reinstall. By default, it installs the latest version. if this is different to what is currently installed, treat it as a different version being specified.
If a different version is specified, what should happen? Some apps support multiple versions installed (e.g. python), other’s dont.
If it supports multiple versions, it would depend on the version specified. E.g. Installed python = 3.7.9, 3.6.2, 3.8.5
winget install python --version "3.8.9"
Now we have 4 installedwinget install python --version "3.8"
replaces 3.8.5 with 3.8.latest. Note that this relies on #227 first.If it only supports one version, then you’d expect it to replace the current installation.
@denelon I have tried - the latest release seems to resolved the issue.
Many of the challenges we’re trying to work through are related to installers that aren’t as robust as we would like them to be. In many cases, we identify classes of issues and attempt to look at ways we can give hints to the client and users via the winget manifest. There are also additional improvements we’re making on the validation side to provide better information back to PR authors so they know what metadata to add or when things don’t match what was suggested.
Packages that install side-by-side are another problem space we’re working on:
We’re trying to meet developers where they are in terms of installer technologies and capabilities and determine reasonable default behaviors (and arguments to control behavior). Over time, we’re hoping more developers will learn from user feedback associated with the Windows Package Manager to improve experiences.
Seems like the issue is just around default behavior, and other behavior could be solved with flags rather than workarounds like uninstalling first. ie:
If it skips by default, and you want to repair the command could be something like
winget install --force
if it reinstalls by default, and you want it to skip it could be something like
winget install --skip-installed
like @josh-65 suggested.Edit: Seems the syntax apt uses is
apt-get --reinstall install PackageNameHere
to force repair/reinstall. Not sure if the UX would be better to be similar to other existing package managers.Even if it does have version information it still gets re-installed using
winget install
. I don’t think any one here is talking about the upgrade command anyway.