2

I am trying to detect an install condition in a Wix Bootstrapper (*.wxs) source file. Wix declares "Burn Built-in Variables" in documentation here.

My source code looks like this:

<util:RegistrySearch
  Id="SearchForMyProduct"
  Variable="MyProductIsInstalled"
  Result="exists"
  Root="HKLM"
  Key="SYSTEM\CurrentControlSet\services\MyProduct" />

<bal:Condition Message="service was found. MyProduct is already installed. Please uninstall and try again">
  (WixBundleAction = 3) AND (MyProductIsInstalled = 0)
</bal:Condition>

I do not see in the Burn log that WixBundleAction is set. No matter what value I test WixBundleAction against, (WixBundleAction = 3) is FALSE. The behavior is the same whether I execute the installer via double-click or from the command-line.

user3628987
  • 576
  • 6
  • 6

1 Answers1

3

It depends on the Variable. For WixBundleAction, the documentation says that it happens when the bundle starts up (based on command line parameters) and during the Plan phase.

WixBundleAction - set to the numeric value of BOOTSTRAPPER_ACTION
                  from the command-line and updated
                  during the call to IBootstrapperEngine::Plan().
Sean Hall
  • 7,629
  • 2
  • 29
  • 44
  • 1
    Unfortunately, this means WixBundleAction can't be used in any conditionals that execute before Plan( ) -- such as ExePackage DetectCondition or MsiPackage InstallCondition -- because Plan( ) sets it. Thank you, this answer ended hours of frustration on why the conditions didn't work. – Ed Bayiates May 08 '19 at 20:22