问题描述:

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.

相关阅读:
Top