Skip to content

Commit

Permalink
[MM-61994] Fix UpgradeCode to use the old one, allow MSI to uninstall…
Browse files Browse the repository at this point in the history
… both
  • Loading branch information
Wipeout55 committed Dec 3, 2024
1 parent b73d68c commit 61db5b2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
3 changes: 2 additions & 1 deletion electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@
"include": "scripts/installer.nsh"
},
"msi": {
"additionalWixArgs": ["-ext", "WixUtilExtension"]
"additionalWixArgs": ["-ext", "WixUtilExtension"],
"upgradeCode": "{8523DAF0-699D-4CC7-9A65-C5E696A9DE6D}"
},
"rpm": {
"fpm": ["--rpm-rpmbuild-define", "_build_id_links none", "--rpm-digest=sha256"]
Expand Down
21 changes: 16 additions & 5 deletions patches/app-builder-lib+24.13.3.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/node_modules/app-builder-lib/templates/msi/template.xml b/node_modules/app-builder-lib/templates/msi/template.xml
index 2d5cd3c..92a0556 100644
index 2d5cd3c..0ce1b74 100644
--- a/node_modules/app-builder-lib/templates/msi/template.xml
+++ b/node_modules/app-builder-lib/templates/msi/template.xml
@@ -1,5 +1,8 @@
Expand All @@ -12,7 +12,18 @@ index 2d5cd3c..92a0556 100644
<!-- https://blogs.msdn.microsoft.com/gremlininthemachine/2006/12/05/msi-wix-and-unicode/ -->
<Product Id="*" Name="${productName}" UpgradeCode="${upgradeCode}" Version="${version}" Language="1033" Codepage="65001" Manufacturer="${manufacturer}">
<Package Compressed="yes" InstallerVersion="500"/>
@@ -26,6 +29,27 @@
@@ -13,6 +16,10 @@

So, AllowSameVersionUpgrades="yes" allows to build and test MSI with the same version, and previously installed app will be removed.
-->
+ <!-- Remove versions of newer MSI using the wrong UpgradeCode -->
+ <Upgrade Id="{0F183CAA-DF79-5400-A71F-684F563AF31C}">
+ <UpgradeVersion Property="PREVMSIINSTALLER" IncludeMaximum="yes" Maximum="${version}" MigrateFeatures="yes" OnlyDetect="no"/>
+ </Upgrade>
<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage='A newer version of "[ProductName]" is already installed.'/>
<MediaTemplate CompressionLevel="${compressionLevel}" EmbedCab="yes"/>

@@ -26,6 +33,27 @@
<Property Id="ARPPRODUCTICON" Value="${iconId}"/>
{{ } -}}

Expand Down Expand Up @@ -40,23 +51,23 @@ index 2d5cd3c..92a0556 100644
{{ if (isRunAfterFinish) { }}
<CustomAction Id="runAfterFinish" FileKey="mainExecutable" ExeCommand="" Execute="immediate" Impersonate="yes" Return="asyncNoWait"/>
{{ if (!isAssisted) { }}
@@ -42,6 +66,7 @@
@@ -42,6 +70,7 @@
<Property Id="ALLUSERS" Secure="yes" Value="2"/>
{{ } -}}
<Property Id="MSIINSTALLPERUSER" Secure="yes" Value="1"/>
+ <Property Id="DISABLEAUTOUPDATE" Value="0"/>

{{ if (isAssisted) { }}
<WixVariable Id="WixUISupportPerUser" Value="1" Overridable="yes"/>
@@ -80,6 +105,7 @@
@@ -80,6 +109,7 @@
</UI>
{{ } -}}

+ <Directory Id="resourcesDir" Name="APPLICATIONFOLDER:\resources\"/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="${programFilesId}">
{{ if (menuCategory) { }}
@@ -110,6 +136,10 @@
@@ -110,6 +140,10 @@
{{-dirs}}

<ComponentGroup Id="ProductComponents" Directory="APPLICATIONFOLDER">
Expand Down

0 comments on commit 61db5b2

Please sign in to comment.