wixwindows-installerwix3.5

Wix Boolean Property Values Don't Work


I have the following property:

<Property Id="UPDATEDB">1</Property>

A checkbox in the UI bound to that 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 which 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 a value of 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 checkbox is checked anyway. That said, the 0 passed in seems to be respected and the RunDbMigration action is not run...

What's going on here? Why is this such rocket science?


Solution

  • As others have mentioned, Checkboxes are not boolean in a 1/0 sense, they're boolean in a null/not-null sense.

    To unset from the command line - you would want to use something like

    msiexec /i "Setup.msi" /l* UPDATEDB=""
    

    Chances are that your condition is looking specifically for the value of 1 before executing your custom action, which is why your CA isn't being run.