15

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= "****" ?>

1 Answer 1

30

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.