Wix buffer property values do not work
I have the following property:
<Property Id="UPDATEDB">1</Property>
A checkbox in the user interface associated with this property: <Control Id="updateDatabase" Type="CheckBox" CheckBoxValue="1" Height="15" Width="95" X="20" Y="74" Text="Update Database" Property="UPDATEDB" />
And a custom action that does something based on the value of this property
<CustomAction Id="RunDbMigration" Directory="INSTALLDIR" Return="check" ExeCommand='[DBMIGRATIONDIR]\DbMigration.exe' /> <InstallExecuteSequence> <Custom Action="RunDbMigration" After="InstallFinalize">UPDATEDB=1 AND NOT Installed</Custom> </InstallExecuteSequence>
If I try to pass the value 0 for UPDATEDB from the command line:
msiexec /i "Setup.msi" /l* UPDATEDB=0
or
msiexec /i "Setup.msi" /l* UPDATEDB="0"
the value of the flag is checked in any case. However, 0 passed, it seems to be respected and the RunDbMigration action does not start ...
What's going on here? Why is this rocket science?
As others noted, checkboxes are not logical in the sense of 1/0, they are logical in the sense of null / not-null.
To disconnect from the command line - you would like to use something like
msiexec /i "Setup.msi" /l* UPDATEDB=""
Most likely, your condition specifically looks for a value of 1 before performing custom actions, so your CA does not start.
Installer properties are either set to or not set. Internally, the value is just a string, so "0", "1", "true" and "false" are the same.
The checkbox element is checked when its property is set to (does not matter what) and is not checked when its property is empty.
This command line sets the property and checks the checkbox:
msiexec /i "Setup.msi" /l* UPDATEDB="0"
No property is set on this command line, so the check box is unchecked:
msiexec /i "Setup.msi" /l*
The problem is CheckBoxValue = "1" . You will find a solution for your question here: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/How-to-conditionally-check-uncheck-a-checkbox-td5539262.html