Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define a global variable in WiX

Tags:

wix

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= "****" ?>
like image 701
RKM Avatar asked Dec 13 '11 20:12

RKM


1 Answers

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.

like image 115
jdh Avatar answered Sep 26 '22 06:09

jdh