The documentation for if
/ifdef
is slightly confusing. For <?if [expression] ?>
, it states:
- Variables can be used to check for existence
...- If the variable doesn't exist, evaluation will fail and an error will be raised.
It turns out if you just go: <?if $(env.MY_VAR) ?>
and MY_VAR
is not defined, compilation will fail. How do I check for existence?
Ordinarily, this is where one would use an ifdef
, but these work strangely in Wix too. Instead of using $(var.Variable)
syntax, they use <?ifdef Variable?>
, meaning environment variables can't be checked this way.
What do I need to do to get the equivalent of normal c pre-processor:
#ifdef MY_ENVIRONMENT_VARIABLE
in Wix?
<?ifdef MY_ENVIRONMENT_VARIABLE ?>
does not work on its own. – Modillion