|
| 1 | +<?xml version="1.0" encoding="utf-8"?> |
| 2 | + |
| 3 | +<?ifndef ProductVersion?> |
| 4 | +<?error ProductVersion property not defined?> |
| 5 | +<?endif?> |
| 6 | + |
| 7 | +<?define UpgradeCode = "96AEA20C-2FB2-431D-87A4-D7A6E57F70B7"?> |
| 8 | + |
| 9 | +<!-- Define a unique UpgradeCode per platform --> |
| 10 | +<?if $(var.Platform) = "x64"?> |
| 11 | +<?define ProgramFilesFolder = "ProgramFiles64Folder"?> |
| 12 | +<?elseif $(var.Platform) = "x86"?> |
| 13 | +<?define ProgramFilesFolder = "ProgramFilesFolder"?> |
| 14 | +<?endif?> |
| 15 | + |
| 16 | +<!-- https://www.add-in-express.com/docs/wix-setup-package.php --> |
| 17 | +<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> |
| 18 | + <!-- https://wixtoolset.org/documentation/manual/v3/xsd/wix/product.html --> |
| 19 | + <Product Id="*" Name="Arduino CLI" Version="$(var.ProductVersion)" Language="1033" Manufacturer="Arduino Srl." UpgradeCode="$(var.UpgradeCode)"> |
| 20 | + <!-- https://wixtoolset.org/documentation/manual/v3/xsd/wix/package.html --> |
| 21 | + <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine"/> |
| 22 | + <!-- by adding this attribute, you create a single .MSI file as opposed to getting a CAB file along with the .MSI. --> |
| 23 | + <MediaTemplate EmbedCab="yes"/> |
| 24 | + |
| 25 | + <!-- Remove older product(s) early but within the transaction --> |
| 26 | + <MajorUpgrade DowngradeErrorMessage="A newer version of !(bind.property.ProductName) is already installed."/> |
| 27 | + |
| 28 | + <!-- directory structure to create --> |
| 29 | + <!-- https://wixtoolset.org/documentation/manual/v3/howtos/files_and_registry/add_a_file.html --> |
| 30 | + <!-- Outermost folder (kind of virtual). Fixed entry. --> |
| 31 | + <Directory Id="TARGETDIR" Name="SourceDir"> |
| 32 | + <!-- "ProgramFilesFolder" is a variable containing the absolute path. --> |
| 33 | + <!-- For a list of folder variables, see: http://msdn.microsoft.com/en-us/library/aa372057%28VS.85%29.aspx --> |
| 34 | + <Directory Id="$(var.ProgramFilesFolder)" Name="Program Files"> |
| 35 | + <!-- All folders from here on are relative to their parent. --> |
| 36 | + <!-- INSTALLDIR is a property name. We need it later for the UI (to be able to change the install dir. --> |
| 37 | + <Directory Id="INSTALLDIR" Name="Arduino CLI"/> |
| 38 | + </Directory> |
| 39 | + </Directory> |
| 40 | + |
| 41 | + <!-- Determine the directory of a previous installation (if one exists). If not INSTALLDIR stays empty --> |
| 42 | + <Property Id="INSTALLDIR"> |
| 43 | + <RegistrySearch Id="InstallDir" Root="HKLM" Key="SOFTWARE\Arduino\CLI" Name="InstallDir" Type="directory"/> |
| 44 | + </Property> |
| 45 | + |
| 46 | + <!-- Features define which parts of the application can be installed in a custom installation --> |
| 47 | + <Feature Id="DefaultFeature" ConfigurableDirectory="INSTALLDIR"> |
| 48 | + <Component Directory="INSTALLDIR"> |
| 49 | + <File Name="arduino-cli.exe"/> |
| 50 | + <Environment Id="Path" Action="set" Name="PATH" Part="last" System="yes" Value="[INSTALLDIR]"/> |
| 51 | + </Component> |
| 52 | + |
| 53 | + <!-- Persist the INSTALLDIR and restore it in subsequent installs --> |
| 54 | + <Component Directory="INSTALLDIR"> |
| 55 | + <RegistryValue Root="HKLM" Key="SOFTWARE\Arduino\CLI" Name="InstallDir" Type="string" Value="[INSTALLDIR]"/> |
| 56 | + </Component> |
| 57 | + </Feature> |
| 58 | + |
| 59 | + <!-- Broadcast environment variable changes --> |
| 60 | + <!-- https://wixtoolset.org/documentation/manual/v3/customactions/wixsettingchange.html --> |
| 61 | + <CustomActionRef Id="WixBroadcastEnvironmentChange" /> |
| 62 | + |
| 63 | + <!-- Use customized WixUI_InstallDir that removes WixUI_LicenseAgreementDlg --> |
| 64 | + <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"/> |
| 65 | + <UIRef Id="ArduinoCLI_InstallDir"/> |
| 66 | + </Product> |
| 67 | +</Wix> |
0 commit comments