microsoft / microsoft/winget-cli

winget upgrade should be able to force close programs and apply the upgrade

Open
#5,856 6 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Feature
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Relevant area(s)

WinGet CLI

Description of the new feature / enhancement

I tried running an upgrade yet it failed with:

Files modified by the installer are currently in use by a different application. Exit the applications then try again.
Installer failed with exit code: 6

Now I have to manually figure out the process that generates the issue, even though I simply want to force the upgrade. I don't care how the program in question is closed or if there might be data loss. I only care that the upgrade is applied with as little user interaction as possible.

Full log:

winget upgrade --all --silent
Name       Id                   Version Available Source
--------------------------------------------------------
OBS Studio OBSProject.OBSStudio 32.0.1  32.0.2    winget
1 upgrades available.

Installing dependencies:
This package requires the following dependencies:
  - Packages
      Microsoft.VCRedist.2015+.x64
(1/1) Found OBS Studio [OBSProject.OBSStudio] Version 32.0.2
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Successfully verified installer hash
Starting package install...
The installer will request to run as administrator. Expect a prompt.
Files modified by the installer are currently in use by a different application. Exit the applications then try again.
Installer failed with exit code: 6

I also tried:

 winget upgrade --all --silent --force
Proposed technical implementation details

I don't have strong preferences about the implementation details, yet I could see either a prompt that the user has to enter y / n or a flag like --quit-running. This feature may be added to an existing flag like --force.

My assumption already was that both/either --silent and/or --force would make the upgrade proceed.


If there are other alteratives to solve this like upgrading the program in the background, and old version still running as long as the process exists, I am also fine with that.

Goal is: Force upgrade the program no matter what the current state is.

(This may also apply if the program was installed with a different source than winget. I may open a different issue for that though.)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with winget upgrade --all --silent and compare it with winget upgrade --all --silent --force. Trace the WinGet CLI upgrade flow and installer handling from these entry points. Done means a defined force-close or equivalent behavior applies the upgrade with minimal interaction, including the reported in-use-files case.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.