I have the following snippet in my program.wxs
file:
<?ifndef $(var.TwoOnly) ?>
<Feature Id="FeatureOne" ... >
...
</Feature>
<?endif ?>
<?ifndef $(var.OneOnly) ?>
<Feature Id="FeatureTwo" ... >
...
</Feature>
<?endif ?>
I'm compiling this using the following comand:
candle -dOneOnly=1 program.wxs
Looking at the compiled program.wixobj
, I can see that Feature Two's declaration is all there, and after running light
, both features are listed, and the installer functions exactly as if neither OneOnly
or TwoOnly
were set. Why is my ifndef
block not working correctly?
Note: I also have the following:
<?ifdef $(var.OneOnly) ?>
<?define productName = One Only ?>
<?else?>
<?ifdef $(var.TwoOnly) ?>
<?define productName = Two Only ?>
<?else?>
<?define productName = Both ?>
<?endif?>
<?endif?>
The name, even when OneOnly
is set during compile, is displayed as Both
.
Edit
I've reduced the complexity of my condition to the minimal case shown in the documentation:
<?ifndef $(var.TwoOnly) ?>
<?include featureOne.wxi ?>
<?endif?>
This still does not work.
When using ifdef
or ifndef
, the variable must be stated without $(var.)
syntax.
<?ifndef TwoOnly ?>
<?include featureOne.wxi ?>
<?endif?>
This works.