-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Packaging] Optimize MSI upgrade performance by simplifying file replacement logic #32678
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
base: dev
Are you sure you want to change the base?
Conversation
️✔️AzureCLI-FullTest
|
|
Hi @wangzelin007, |
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR optimizes the Windows MSI upgrade performance for Azure CLI by implementing two key changes to the Windows Installer configuration: moving the product removal step earlier in the upgrade sequence and forcing unconditional file reinstallation during upgrades.
Changes:
- Relocated
RemoveExistingProductsto run beforeInstallInitializeinstead of afterInstallExecute, ensuring old versions are completely removed before installing new files - Added
REINSTALLMODE=amusproperty to skip version comparison and force reinstallation of all files during upgrades - Added explanatory comments documenting the rationale for both changes, including references to issue #32045
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Related command
Description
This PR optimizes the MSI upgrade experience by simplifying the file replacement logic during Azure CLI upgrades. Instead of relying on Windows Installer's complex file versioning comparison, we now use a clean uninstall-then-install approach with
REINSTALLMODE=amus.Background
Windows Installer's default upgrade behavior performs file-by-file version comparison to decide whether to replace each file. For Azure CLI with thousands of Python files and packages, this comparison process is time-consuming and can lead to unpredictable results when files lack version resources.
Changes
Two optimizations in
build_scripts/windows/Product.wxs:RemoveExistingProducts Before="InstallInitialize"This removes the old version completely before installing the new version, eliminating the need for complex file-by-file comparisons.
The amus mode instructs Windows Installer to reinstall all files unconditionally, skipping version comparison overhead.
Benefits
Performance Improvements
Test Screenshots

References
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.