I was under the impression that the expression
$(var.MyVar)
a preprocessor evaluation, evaluated at a similar time to <?if ?>.

However, some wix that I am compiling suggests this isn't the case.
I'm trying to define a variable as follows:

<?if someCondition ?>
<?define MyVariable="Server=&quot;MyServer.exe&quot;"?>
<?else ?>
<?define MyVariable=""?>
<?endif ?>

And then my wix example as:

<Class Id="<GUID>" ... $(var.MyVariable) >
...
</Class>

So in other words, in case one preprocessor condition is set, I want the 
attribute text specified in MyVariable to show up in the Class element 
definition, and otherwise I don't. Note that specifying the value of the 
attribute as empty I don't think is acceptable because in the case where I have 
the attribute non-existant, it would be an error to have the attribute defined 
at all, even as empty (someone can correct me if these are in fact equivalent 
to the compiler).

However, when trying to compile this I get the error:


error CNDL0104 : Not a valid source file; detail: Name cannot begin with the 
'$' character, hexadecimal value 0x24. Line 33, position 163.



So instead of taking the varaible contents and replacing them and then parsing 
the XML, it appears to be trying to parse the XML first, and then replacing the 
variables, which leads to only being able to use them in attribute values but 
not in the XML itself.

Is there a way to do what I am after without resorting to duplicating a bunch 
of wix XML within <?if ?><?else ?> blocks to conditionally include or exclude 
the attribute at compile time?

--
Bryan
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to