How do I to pass in a WiX variable defined in another file (without redefining it again)?
It seems like the standard way of defining a variable is this:
<?define Var1= "****" ?>
That's right, you can define some variables in this syntax. Then include them in a separate WiX include file, with the extension .wxi
. (like a .h
include file), for example MyWixDefines.wxi
. Then in your other WiX file Fragments, include this file, like this:
<?include MyWixDefines.wxi ?>
And finally, in the other fragments, you reference the variable like this:
<Icon Id="myIcon" SourceFile="$(var.Var1)\images\someicon.ico" />
A reminder: The variable is resolved at WiX compile time. It's not dynamically available at install time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With