Is your component in main.wxs or in some other file. If it is in main.wxs,
is it above or below your definition?

<?define?> in wxs works like #define in cpp: you have to define it before
you use it, and the definition exists for the file it is in (unless included
in other files). That is why .wxi files exist (see the help for
<?include?>).

-----Original Message-----
From: jo...@msli.com [mailto:jo...@msli.com] 
Sent: Friday, July 24, 2009 12:19 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] correctly define preprocessor var in wxs?

In my main wxs, I have

<?define MyVar="foo.exe" ?>
<?ifndef MyVar ?>
      <?error MyVar must be defined ?>
<?endif?>

which does cause candle to fail if I comment out the define.

And in a Component, I have 
   Target="[INSTALLDIR]$(var.MyVar)"

If I run candle with out:
  -dMyVar="foo.exe"
I get the error: 
  Undefined preprocessor variable '$(var.MyVar)'.

If I run candle with:
  -dMyVar="foo.exe"
Candle succeeds.

What is my malfunction?

On Fri, 2009-07-24 at 20:00 +0100, Russell Hind wrote:
> To define pre-processor variables (equivelant to -d passed to  
> Candle.exe) use
> 
> <?define MyVar="foo.exe" ?>
> 
> Cheers
> 
> Russell
> 
> On 24 Jul 2009, at 19:47, jo...@msli.com wrote:
> 
> > I have been struggling to find one simple example of defining a
> > preprocessor variable in the wxs file.
> >
> > Currently, If I Append this to my candle command line:
> >   -dMyVar='foo.exe'
> > then references to $(var.MyVar) in wxs work.
> > But no matter how I define MyVar in the main wxs, they are not found.
> >
> > Why does this not work, defined in my main project wxs?
> > <WixVariable Id='MyVar' Value='foo.exe' />
> >
> >
> > Until that works, I can't hope to reach my goal of using an  
> > environment
> > variable (ExeName):
> > <?ifdef $(env.ExeName) ?>
> > <WixVariable Id='MyVar' Value="$(env.ExeName)" />
> > <?else?>
> > <WixVariable Id='MyVar' Value='foo.exe' />
> > <?endif?>
> >
> >
> > CONFIDENTIALITY NOTICE:  This electronic mail message and any  
> > attachment hereto may contain confidential information of Meyer  
> > Sound Laboratories, Incorporated and is intended for the personal  
> > and confidential use of the designated recipient(s) only.  If you  
> > are not the intended recipient (or responsible for delivering the  
> > message to the intended recipient), you have received this message  
> > in error and any review, distribution, or copying of this message or  
> > any attachment hereto is prohibited.  If you have received this  
> > message in error, please promptly notify the sender and permanently  
> > delete it from your computer.
> >
> >
----------------------------------------------------------------------------
--
> > _______________________________________________
> > WiX-users mailing list
> > WiX-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> 
> 
>
----------------------------------------------------------------------------
--
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users


CONFIDENTIALITY NOTICE:  This electronic mail message and any attachment
hereto may contain confidential information of Meyer Sound Laboratories,
Incorporated and is intended for the personal and confidential use of the
designated recipient(s) only.  If you are not the intended recipient (or
responsible for delivering the message to the intended recipient), you have
received this message in error and any review, distribution, or copying of
this message or any attachment hereto is prohibited.  If you have received
this message in error, please promptly notify the sender and permanently
delete it from your computer.

----------------------------------------------------------------------------
--
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to