From 4e544ec50e5608400d53c8a77b10beadd578781a Mon Sep 17 00:00:00 2001 From: leileizhang Date: Tue, 11 Nov 2025 20:07:58 +0800 Subject: [PATCH] Fix the issue where the InstallLocation is missing after upgrading (#43462) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary of the Pull Request **Root Cause** The issue occurs because the Installed property in MSI indicates whether the current product code has been installed on the machine. During a Major Upgrade (where the old and new versions have different ProductCode values), the installation sequence is: 1. Burn schedules uninstall of the old MSI (the old version might not have this custom action). 2. Then installs the new MSI. > - At this point, the current product has not yet been installed, so the Installed property is empty. > - The condition NOT Installed evaluates to true, and SetBundleInstallLocationData / SetBundleInstallLocation executes normally, writing the InstallLocation registry key. This means upgrading from an older version without this function to a newer version with it works correctly. However, issues appear in subsequent upgrades (from “newer” → “newer”) because both versions include the same custom action. The previous condition restricted the action to run only on first install, preventing it from running during upgrades. **Fix** Added `OR WIX_UPGRADE_DETECTED` to the condition of SetBundleInstallLocationData / SetBundleInstallLocation custom actions, so they also execute during upgrade scenarios, ensuring the InstallLocation registry value is correctly updated after version upgrades. ## PR Checklist - [x] Closes: #43451 - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx ## Detailed Description of the Pull Request / Additional comments ## Validation Steps Performed --- installer/PowerToysSetupVNext/Product.wxs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installer/PowerToysSetupVNext/Product.wxs b/installer/PowerToysSetupVNext/Product.wxs index 556fddc7f4..3e812beb2e 100644 --- a/installer/PowerToysSetupVNext/Product.wxs +++ b/installer/PowerToysSetupVNext/Product.wxs @@ -120,8 +120,8 @@ - - + +