Home > Net >  Configuring the parameter in the ExeCommand of Wix
Configuring the parameter in the ExeCommand of Wix

Time:02-10

In my Wix installer project, I am launching an executable through custom action and passing input parameters to the executable through ExeCommand.

<CustomAction Id="LaunchExecutable" Execute="deferred"
             ExeCommand='&quot;[INSTALLDIR]Product.exe&quot; /install "STAGING"'
             Directory="INSTALLDIR"
             Impersonate="yes"
             Return="ignore" />

I want to avoid hardcoding the "STAGING" in ExeCommand and pass it as a variable like $(var.Environment). I want the ExeCommand to look something like this :

   <?define Environment= Staging?>
    ExeCommand='&quot;[INSTALLDIR]Product.exe&quot; /install $(var.Environment)'  

Is there a way to configure the parameter ? I tried doing it but I recieved Undefined preprocessor error.

CodePudding user response:

I was able to get this working by enclosing the $(var.Environment) with quot like :

 ExeCommand="&quot;[INSTALLDIR]Product.exe&quot; /install &quot;$(var.Environment)&quot;"  
  • Related