microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
23.37k stars 1.45k forks source link

Install --uninstall-previous fails with different install technology #4677

Open samuelspiza opened 4 months ago

samuelspiza commented 4 months ago

Brief description of your issue

I was trying to investigate why LocalSend.LocalSend upgrade from 1.14.0 to 1.15.1 is silently ignored when running winget upgrade --all ( #1985 ) and found out it was due to different install technologies. I than tried winget install --id=LocalSend.LocalSend -e --uninstall-previous (Later I found that the 1.15.1 manifest even has a option called UpgradeBehavior: uninstallPrevious set). I assume that is the command that is specifially intended for this scenario. But to my supprise the command failed indicating that the previous version must be uninstalled first and than a new version can be installed. My expectation is that install --uninstall-previous should do precisly that.

Steps to reproduce

winget install --id=LocalSend.LocalSend -e --version 1.14.0
winget install --id=LocalSend.LocalSend -e --uninstall-previous --version 1.15.1

Expected behavior

winget install --uninstall-previous should uninstall the old version and install the new version regardless of the install technologies used.

Actual behavior

Install fails/is skipped

PS> & winget install --id=LocalSend.LocalSend -e --uninstall-previous
Es wurde bereits ein vorhandenes Paket gefunden. Es wird versucht, das installierte Paket zu aktualisieren...
Die Installationstechnologie der angegebenen neueren Version unterscheidet sich von der aktuell installierten Version. Deinstallieren Sie das Paket, und installieren Sie die neuere Version.

Environment

Windows-Paket-Manager v1.8.1911
Copyright (c) Microsoft Corporation. Alle Rechte vorbehalten.

Windows: Windows.Desktop v10.0.19045.4651
Systemarchitektur: X64
Paket: Microsoft.DesktopAppInstaller v1.23.1911.0
github-actions[bot] commented 4 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

denelon commented 4 months ago

Can you share verbose logs with the failure scenario by adding "--verbose-logs --logs" to the command?

Do you get the same behavior with:

winget upgrade LocalSend.LocalSend

samuelspiza commented 4 months ago

Yes the result from upgrade und install+uninstall-previous are pretty much the same.

PS> & winget upgrade --id=LocalSend.LocalSend -e --verbose-logs --logs
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.
PS> & winget install --id=LocalSend.LocalSend -e --uninstall-previous --verbose-logs --logs
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.
PS> & winget --info
Windows Package Manager v1.8.1911
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.19045.4651
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.23.1911.0

I attached the two log file from the two commands.

WinGet-2024-07-25-17-27-14.419.log WinGet-2024-07-25-17-27-50.688.log

/EDIT: As further info & winget uninstall LocalSend.LocalSend; & winget install LocalSend.LocalSend works just as expected. So it's not that uninstall can't remove the software anymore.

denelon commented 4 months ago

OK, I think I might have an idea about what "might" be happening. I'll chat with our engineering folks to see if that's the issue.

denelon commented 4 months ago

What happens with:

winget upgrade --id=LocalSend.LocalSend -e --uninstall-previous --version 1.15.1

samuelspiza commented 4 months ago
winget upgrade --id=LocalSend.LocalSend -e --uninstall-previous --version 1.15.1 --verbose-logs --logs
The install technology of the newer version specified is different from the current version installed. Please uninstall the package and install the newer version.

WinGet-2024-07-25-18-17-56.383.log

denelon commented 4 months ago

Thanks for sharing the logs.