Skip to content

Commit 73446bd

Browse files
committed
{Packaging} Optimize MSI upgrade performance with REINSTALLMODE=amus
1 parent 6c1968d commit 73446bd

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

build_scripts/windows/Product.wxs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@
4949
<UpgradeVersion Property="WIX_DOWNGRADE_DETECTED" Minimum="$(var.ProductVersion)" IncludeMinimum="no" OnlyDetect="yes" />
5050
</Upgrade>
5151
<InstallExecuteSequence>
52-
<RemoveExistingProducts After="InstallExecute" />
52+
<!-- RemoveExistingProducts runs BEFORE InstallInitialize to completely remove old version first.
53+
This prevents DLL conflicts when upgrading across Python versions (e.g., 3.12 to 3.13).
54+
See: https://github.com/Azure/azure-cli/issues/32045 -->
55+
<RemoveExistingProducts Before="InstallInitialize" />
5356
</InstallExecuteSequence>
5457

5558
<!-- New product architectures should upgrade the original x86 product - even of the same version. -->
@@ -74,6 +77,13 @@
7477
<Property Id="MSIFASTINSTALL" Value="7" />
7578
<Property Id="ApplicationFolderName" Value="Microsoft SDKs\Azure" />
7679
<Property Id="WixAppFolder" Value="WixPerMachineFolder" />
80+
81+
<!-- Force reinstall of all files during upgrade to handle cross-Python-version upgrades.
82+
'a' = Force reinstall of all files regardless of version
83+
This is necessary because pywin32's .pyd files have version numbers like 3.11.xxx or 3.13.xxx,
84+
and MSI's version comparison may incorrectly determine that older Python version files are "newer".
85+
See: https://github.com/Azure/azure-cli/issues/32045 -->
86+
<SetProperty Id="REINSTALLMODE" Value="amus" Before="CostFinalize" Sequence="both">WIX_UPGRADE_DETECTED</SetProperty>
7787

7888
<Feature Id="ProductFeature"
7989
Title="Microsoft Azure CLI"

0 commit comments

Comments
 (0)