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='"[INSTALLDIR]Product.exe" /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='"[INSTALLDIR]Product.exe" /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=""[INSTALLDIR]Product.exe" /install "$(var.Environment)""