WiX Tips
Some tips on using WiX to generate MSI installers:
-
The GUID used as Product Id has to be unique for each release of the package. That is version 1.0 & 1.1 should have different product ids. So it's best to use auto-generated GUIDs for this like this:
<product Id="*"... />
In other words do not hard code the product id.
-
MSI only recognizes three quadrant product version numbers.
-
Product upgrades essentially work by uninstalling the current version and then installing the new version.
-
From MSI v3.5 onward upgrades are supported through the
<MajorUpgrade.. />
tag.
-
MSI does not define special actions for uninstallation. In fact, uninstallation is also treated as a type of installation. So if you want to run a custom action during uninstall, you have to use Condition predicates that cause them to run only during uninstallation. For example the following custom action is only run during uninstall as REMOVE="ALL" evaluates to TRUE only when all components are removed, which is during uninstall.
<Custom Action="CA_QuitHelper" Before="InstallValidate">REMOVE="ALL"</Custom>
-
If you want an action to be run during uninstall as well as during upgrade, additional condition predicates are necessary. Specifically:
<Custom Action="CA_QuitHelper" Before="InstallValidate">(REMOVE="ALL") OR (UPGRADINGPRODUCTCODE) OR (WIX_UPGRADE_DETECTED)</Custom>
. UPGRADINGPRODUCTCODE and WIX_UPGRADE_DETECTED are set to TRUE when doing inline product upgrade.
-
Note the use of Before="InstallValidate" in the above tag. This ensures that the task is launched before installation (or uninstallation) starts.
-
Similarly, if you want a custom action to be executed only during installation using the condition predicated NOT INSTALLED. For eg:
<Custom Action="CA_LaunchTask" After="InstallFinalize">NOT INSTALLED</Custom>
.
-
Custom action type 18, which executes an installed program, requires ExeCommand attribute specifying the command arguments, even if the program requires no arguments.
<CustomAction Id="CA_LaunchTask" FileKey="TaskBinaryEXE" ExeCommand="" Return="asyncNoWait" Impersonate="yes" />
.
-
The file that is referened to in FileKey above has to be a one of the
<File Id="TaskBinaryEXE".. />
keys.