Skip to content
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

Enable winget to upgrade itself #505

Closed
JohnMcPMS opened this issue Jul 20, 2020 · 17 comments
Closed

Enable winget to upgrade itself #505

JohnMcPMS opened this issue Jul 20, 2020 · 17 comments
Labels
Issue-Feature This is a feature request for the Windows Package Manager client. msstore Issue related to "msstore" REST source
Milestone

Comments

@JohnMcPMS
Copy link
Member

Description of the new feature/enhancement

Winget cannot update it's own package currently, due to the following sequence:

  1. winget begins deployment of its package
  2. Windows deployment for MSIX needs all processes for the package to be shut down
  3. Deployment sends a CTRL-C message to processes with no active windows
  4. winget responds to CTRL-C message with cancellation of the deployment operation

So a whole lot of nothing happens.

Proposed technical implementation details

The most straightforward way is probably to special case this scenario. We could also do some work to run afterward to report the result. For instance (install or update eventually):

winget install winget
... all boilerplate until install progress ...
winget needs to terminate in order to update itself, see you in a bit.

Once completed, a new (cmd, unless you can somehow set the default subsystem CONSOLE handler) window comes up to automatically run:

winget post-self-update
Success, winget has been updated to v0.1.99999
Press enter to close this window

or

winget post-self-update
winget update failed: Some perfectly valid reason I'm sure.
winget is still running v0.1.12345
Press enter to close this window
@JohnMcPMS JohnMcPMS added the Issue-Feature This is a feature request for the Windows Package Manager client. label Jul 20, 2020
@ghost ghost added the Needs-Triage Issue need to be triaged label Jul 20, 2020
@JohnMcPMS JohnMcPMS added this to the Package Manager Backlog milestone Jul 20, 2020
@JohnMcPMS JohnMcPMS removed the Needs-Triage Issue need to be triaged label Jul 20, 2020
@zachcarp zachcarp assigned zachcarp and unassigned zachcarp Jul 20, 2020
@Croydon
Copy link

Croydon commented Jul 7, 2021

Given that winget will be part of the App Installer bundle, pre-installed and updated over the Windows Store AND that winget also plans support for Windows Store applications... is this issue in the current form still relevant?

@denelon
Copy link
Contributor

denelon commented Jul 12, 2021

@Croydon, there are several different scenarios at play when we take into account enterprise Group Policy, and private sources. Some systems may have the Microsoft Store disabled, and they may be on their own private networks. It would still be possible to pull in a copy of the App Installer and provide it via a private REST source.

@denelon denelon changed the title Enable winget to update itself Enable winget to upgrade itself Jul 16, 2021
@lovettchris
Copy link
Member

When winget is available as a built in then "winget upgrade winget" should switch me over from the manually installed appxbundle to the officially supported version from windows.

@denelon
Copy link
Contributor

denelon commented Jul 16, 2021

@lovettchris you should automatically get updates from the Microsoft Store since the releases here are signed. The store would only hand you the "latest" version available for the environment (Windows Insider) or Flight (Partner Center Concept). Once a newer version is published, you would get that update to App Installer.

The ability to use the Windows Package Manager to upgrade itself is not necessary to receive the latest stable version from the Microsoft Store. The only requirement is the version in the store must be higher than the version one has installed.

@denelon denelon added the msstore Issue related to "msstore" REST source label Feb 17, 2022
@denelon
Copy link
Contributor

denelon commented Feb 17, 2022

It is now possible to use the Windows Package Manager to install via the "msstore" source.

winget install "App Installer" -s msstore --force

edited: I added "--force" as this is required in some scenarios.

We still have work with the "msstore" source to report the version in the REST endpoint. We also have work to include monikers in the "msstore" source so the command could be winget install winget -s msstore.

@YakovL
Copy link

YakovL commented Feb 18, 2022

@denelon could you explain it a bit for an "end-user": is it correct that:

  1. winget install "App Installer" -s msstore supposed to update App Installer
  2. winget is a part of App Installer
  3. hence winget install "App Installer" -s msstore is supposed to update winget ..in certain case

?

What are those cases and is it safe to just try winget install "App Installer" -s msstore and see what happens?

@denelon
Copy link
Contributor

denelon commented Feb 18, 2022

@YakovL

  1. Technically it's just asking the Windows Package Manager to install the App Installer.
  2. The Windows Package Manager is distributed with the App Installer.
  3. True

The install command today does not perform validation if a package is already installed. We're likely to start checking to see if a package is already installed so a user can get the correct upgrade behavior for packages that require certain switches to be passed to the installer for the upgrade scenario to function correctly (Visual Studio is an example of this).
In the future, we may add a repair option for MSIX packages, and with the switch to the "upgrade" behavior, you could still pass "--force" to insist the Windows Package Manager perform the install action "winget install "App Installer" -s msstore --force`.

Yes, you are likely to be prompted about which version of App Installer you are attempting to install, and you will be informed if the version you are about to install is "older" than the one present on your system.

@santagada
Copy link

Does this work? because I tried and winget just spins on "Starting package install..." forever.

winget v1.3.2691
windows 21h2

@denelon
Copy link
Contributor

denelon commented Feb 15, 2023

@santagada is a bad user experience, but yes it will work.

Depending on the version difference, I've seen it hang in the progress bar, and I've seen it throw an exception. Generally, if I wait a few seconds after that point, I can either [ctrl]+[c] or restart my terminal and run winget -v to see if the new version is installed.

@hariomsai7
Copy link

winget install winget --accept-source-agreements --accept-package-agreements --force

winget -v
v1.4.10173

winget upgrade -all
winget upgrade -all -silent

@santagada
Copy link

Having to kill the application after a while is really bad for automation. Winget is supposed to be used for automation right? I ask because not having it on server versions kinda confuses me a bit.

@Masamune3210
Copy link

There are very few things you can do when you are trying to use the tool....to update the thing you are using. Especially since this is a package and not a traditional app

@ArchGuyWu
Copy link

ArchGuyWu commented Sep 4, 2023

I found a better way to resolve this, install scoop first, then use scoop to install/update winget. As winget is just an installer, not a package manager.

@denelon
Copy link
Contributor

denelon commented Dec 5, 2023

The App Installer was just added to the community repository so you can now run winget upgrade winget.

@denelon denelon closed this as completed Dec 5, 2023
@denelon denelon modified the milestones: Backlog-Client, v1.7 Client Dec 5, 2023
@ArchGuyWu
Copy link

ArchGuyWu commented Dec 6, 2023

The App Installer was just added to the community repository so you can now run winget upgrade winget.

But the previous version cannot be removed, because it's a part of windows.

@YakovL
Copy link

YakovL commented Dec 6, 2023

tried winget upgrade winget, got ~"No available updates found. No more recent versions in the configured sources." (translated back to English, so the wording may be not accurate) winget -v → v1.6.3133

@Masamune3210
Copy link

The App Installer was just added to the community repository so you can now run winget upgrade winget.

But the previous version cannot be removed, because it's a part of windows.

Yes.....your point is? There isn't any way around that, it happens no matter how you update winget or any in-box app. Its just how Windows handles it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Feature This is a feature request for the Windows Package Manager client. msstore Issue related to "msstore" REST source
Projects
None yet
Development

No branches or pull requests

10 participants