Skip to content

Commit 844b493

Browse files
authored
Fixed WIX template to allow MSI upgrades (#838)
1 parent fed60ae commit 844b493

File tree

1 file changed

+39
-37
lines changed

1 file changed

+39
-37
lines changed

cloudflared.wxs

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,63 @@
22

33
<?if $(var.Platform)="x86"?>
44
<?define Program_Files="ProgramFilesFolder"?>
5-
<?else?>
5+
<?else ?>
66
<?define Program_Files="ProgramFiles64Folder"?>
7-
<?endif?>
7+
<?endif ?>
88
<?ifndef var.Version?>
99
<?error Undefined Version variable?>
10-
<?endif?>
10+
<?endif ?>
1111
<?ifndef var.Path?>
1212
<?error Undefined Path variable?>
13-
<?endif?>
13+
<?endif ?>
1414

1515
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
16-
<Product Id="35e5e858-9372-4449-bf73-1cd6f7267128"
16+
<Product Id="*"
1717
UpgradeCode="23f90fdd-9328-47ea-ab52-5380855a4b12"
1818
Name="cloudflared"
1919
Version="$(var.Version)"
2020
Manufacturer="cloudflare"
2121
Language="1033">
2222

23-
<Package InstallerVersion="200" Compressed="yes" Comments="Windows Installer Package" InstallScope="perMachine"/>
23+
<Package InstallerVersion="200" Compressed="yes" Comments="Windows Installer Package" InstallScope="perMachine" />
2424

25-
<Media Id="1" Cabinet="product.cab" EmbedCab="yes"/>
25+
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
2626

27-
<Upgrade Id="23f90fdd-9328-47ea-ab52-5380855a4b12">
28-
<UpgradeVersion Minimum="$(var.Version)" OnlyDetect="yes" Property="NEWERVERSIONDETECTED"/>
29-
<UpgradeVersion Minimum="2020.8.0" Maximum="$(var.Version)" IncludeMinimum="yes" IncludeMaximum="no"
30-
Property="OLDERVERSIONBEINGUPGRADED"/>
31-
</Upgrade>
32-
<Condition Message="A newer version of this software is already installed.">NOT NEWERVERSIONDETECTED</Condition>
27+
<MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." />
3328

34-
<Directory Id="TARGETDIR" Name="SourceDir">
35-
<!--This specifies where the cloudflared.exe is moved to in the windows Operation System-->
36-
<Directory Id="$(var.Program_Files)">
37-
<Directory Id="INSTALLDIR" Name="cloudflared">
38-
<Component Id="ApplicationFiles" Guid="35e5e858-9372-4449-bf73-1cd6f7267128">
39-
<File Id="ApplicationFile0" Source="$(var.Path)"/>
40-
</Component>
29+
<Upgrade Id="23f90fdd-9328-47ea-ab52-5380855a4b12">
30+
<UpgradeVersion Minimum="$(var.Version)" OnlyDetect="yes" Property="NEWERVERSIONDETECTED" />
31+
<UpgradeVersion Minimum="2020.8.0" Maximum="$(var.Version)" IncludeMinimum="yes" IncludeMaximum="no"
32+
Property="OLDERVERSIONBEINGUPGRADED" />
33+
</Upgrade>
34+
<Condition Message="A newer version of this software is already installed.">NOT NEWERVERSIONDETECTED</Condition>
35+
36+
<Directory Id="TARGETDIR" Name="SourceDir">
37+
<!--This specifies where the cloudflared.exe is moved to in the windows Operation System-->
38+
<Directory Id="$(var.Program_Files)">
39+
<Directory Id="INSTALLDIR" Name="cloudflared">
40+
<Component Id="ApplicationFiles" Guid="35e5e858-9372-4449-bf73-1cd6f7267128">
41+
<File Id="ApplicationFile0" Source="$(var.Path)" />
42+
</Component>
43+
</Directory>
4144
</Directory>
45+
<Component Id="ENVS" Guid="6bb74449-d10d-4f4a-933e-6fc9fa006eae">
46+
<!--Set the cloudflared bin location to the Path Environment Variable-->
47+
<Environment Id="ENV0"
48+
Name="PATH"
49+
Value="[INSTALLDIR]."
50+
Permanent="no"
51+
Part="last"
52+
Action="create"
53+
System="yes" />
54+
</Component>
4255
</Directory>
43-
<Component Id="ENVS" Guid="6bb74449-d10d-4f4a-933e-6fc9fa006eae">
44-
<!--Set the cloudflared bin location to the Path Environment Variable-->
45-
<Environment Id="ENV0"
46-
Name="PATH"
47-
Value="[INSTALLDIR]."
48-
Permanent="no"
49-
Part="last"
50-
Action="create"
51-
System="yes" />
52-
</Component>
53-
</Directory>
54-
55-
56-
<Feature Id='Complete' Level='1'>
57-
<ComponentRef Id="ENVS"/>
58-
<ComponentRef Id='ApplicationFiles' />
59-
</Feature>
56+
57+
58+
<Feature Id='Complete' Level='1'>
59+
<ComponentRef Id="ENVS" />
60+
<ComponentRef Id='ApplicationFiles' />
61+
</Feature>
6062

6163
</Product>
6264
</Wix>

0 commit comments

Comments
 (0)