Search code examples
wixwindows-installerbootstrapperburnwix3.11

Wix Bootstrapper (Burn) Conditional Display of Label


I am trying to diplay label "Install" or "Uninstall" based on the action being performed by the wix burn installer. So far I have tried this:

<?define InstallStatus=[WixBundleAction]?>
    <?if $(var.InstallStatus) = 5?>
    <Variable Name="StatusLabel" Value="Install"/>
    <?else ?>
    <Variable Name="StatusLabel" Value="Uninstall"/>
    <?endif ?>

But it always returns Uninstall. When I checked the log file, I got Initializing string variable 'StatusLabel' to value 'Uninstall'.

When I tried to print InstallStatus, it had no value (""). Seems like it is not set till then.

Is there any other way to achieve it?


Solution

  • <?define InstallStatus=[WixBundleAction]?> is preprocessor code that is evaluated at compile time but WixBundleAction is a Burn variable that isn't available until runtime. In v3.x you have to write code to set a Variable at runtime. In v4, there's a new SetVariable element implemented in #4948 that allows declaratively setting the variable like you're trying to do.

    If you're using wixstdba, then you probably want to know about #4149 which added support for showing a different message for install vs uninstall.