Skip to content

Commit 6252432

Browse files
authored
fix(bundler): swap WIX registry search order to prioritize InstallDir (#14945)
1 parent 2d0b80e commit 6252432

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-bundler": patch:bug
3+
---
4+
5+
Fix WIX installer registry search order so that the named `InstallDir` key takes priority over the NSIS default key, preventing install location from changing on updates.

crates/tauri-bundler/src/bundle/windows/msi/main.wxs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,16 @@
7070
<Property Id="ARPURLUPDATEINFO" Value="{{homepage}}"/>
7171
{{/if}}
7272

73+
<!-- NOTE: The order of RegistrySearch elements below matters. In WIX, when multiple
74+
RegistrySearch elements are listed under a single Property, the LAST successful
75+
match wins. We list the NSIS default-key search first and the MSI InstallDir
76+
search second so that the MSI-specific path takes priority when both keys exist. -->
7377
<Property Id="INSTALLDIR">
74-
<!-- First attempt: Search for "InstallDir" -->
75-
<RegistrySearch Id="PrevInstallDirWithName" Root="HKCU" Key="Software\\{{manufacturer}}\\{{product_name}}" Name="InstallDir" Type="raw" />
76-
77-
<!-- Second attempt: If the first fails, search for the default key value (this is how the nsis installer currently stores the path) -->
78+
<!-- First attempt: Search for the default key value (this is how the nsis installer stores the path) -->
7879
<RegistrySearch Id="PrevInstallDirNoName" Root="HKCU" Key="Software\\{{manufacturer}}\\{{product_name}}" Type="raw" />
80+
81+
<!-- Second attempt: Search for "InstallDir" which takes priority if found (this is how the msi installer stores the path) -->
82+
<RegistrySearch Id="PrevInstallDirWithName" Root="HKCU" Key="Software\\{{manufacturer}}\\{{product_name}}" Name="InstallDir" Type="raw" />
7983
</Property>
8084

8185
<!-- launch app checkbox -->

0 commit comments

Comments
 (0)