Conditional statements and iterations
In this section, we'll take a look at the conditional and looping statements that are available at compile time.
if...elseif...else
The if statement checks whether a preprocessor variable is set to a certain value. If it is, the markup between the opening if
statement and the closing endif
will be compiled. Optionally, it can be followed by an elseif
or else
statement, allowing you to compile other code if the initial condition is false. The entire block must end with endif
. The following snippet is an example that only compiles a Property
element if the preprocessor variable myVar
is equal to 10:
<?if $(var.myVar) = 10 ?> <Property Id="newProperty" Value="5" /> <?endif?>
Here's a more complex example that utilizes ...
Get WiX 3.6: A Developer's Guide to Windows Installer XML now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.