I meant to say MyApp.variables.wxi, not MyApp.variables.wxs. Sorry. I have been working on this too long, my eyes are crossed, and I am making more type-o's. I'm trying to sanitize my problem and keep it concise and problem specific.
When I run the following (all one-line)(run from bash cygwin shell): candle.exe MyApp.wxs MyApp.fragment.wxs -ext WixUIExtension.dll Results in the error: MyApp.variables.wxi(12) : error CNDL0250 : MyVar must be defined But the following (all one-line) (run from bash cygwin shell) candle.exe MyApp.wxs MyApp.fragment.wxs -ext WixUIExtension.dll -dMyVar="${ExeName}" It works. The same is true even if I use cmd shell and 'set ExeName='foo.exe' and then run candle.exe The lines in MyApp.variables.wxi <?ifdef $(env.ExeName) ?> <?define MyVar="$(env.ExeName)" ?> <?endif?> <?ifndef MyVar ?> <?error MyVar must be defined ?> <?endif?> I'm not sure what your last line means. "...needs to specify the wix namespace..." I will try to explain. In my each wxs file, just below line 1 (the line: <?xml version="1.0" encoding="utf-8"? ) I have the following line: <?include MyApp.variables.wxi ?> In the main MyApp.wxs file, I pull in the namespace in my fragment (generate by Paraffin.exe) MyApp.fragment.wxs <Feature Id='Complete' Level='1'> <ComponentGroupRef Id='group_MyApp'/> </Feature> Does that help? On Fri, 2009-07-24 at 18:17 -0700, Blair wrote: > Which error are you getting now? ("MyVar must be defined" or "Undefined > preprocessor variable '$(var.MyVar)'") > > Sorry to ask the obvious, but you appear to be including MyApp.variables.wxs > but you mention creating a wxi file. Is the wxi file named > MyApp.variables.wxs? Most of the time wxi files end in ".wxi" not ".wxs". > > Also, IIRC, the Include (since it is the root element) needs to specify the > wix namespace (not shown in your example). > > -----Original Message----- > From: jo...@msli.com [mailto:jo...@msli.com] > Sent: Friday, July 24, 2009 4:14 PM > To: General discussion for Windows Installer XML toolset. > Subject: Re: [WiX-users] correctly define preprocessor var in wxs? > > I appreciate all the help, and I am sorry for not getting. > Based on what I understand your advice to be, > I have moved the preprocessor variables to a wxi, > <?xml version="1.0" encoding="utf-8"?> > <Include> > <?ifdef $(env.ExeName) ?> > <?define MyVar="$(env.ExeName)" ?> > <?endif?> > <?ifndef MyVar ?> > <?error MyVar must be defined ?> > <?endif?> > </Include> > > And the second line of each wxs file now contains an include statement: > <?include MyApp.variables.wxs ?> > > But I still get the same result. > > What seems to work is calling candle.exe using the environment > variables: > candle.exe MyApp.wxs MyApp.fragment.wxs -ext WixUIExtension.dll -d > -dMyVar="${ExeName}" > > But I thought this is supposed to also work: > candle.exe MyApp.wxs MyApp.fragment.wxs -ext WixUIExtension.dll > > On Fri, 2009-07-24 at 13:41 -0700, Blair wrote: > > 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 > > > 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