Don't use ${ } inside an existing expression.  You use it once to say
this in an expression.. from there Nant knows how to find the keywords,
etc

So instead of      <if test="${not
file::exists(${version-info-script})}">

Use     <if test="${not file::exists('version-info-script')}">

Assuming 'version-info-script' is the name of the file you are looking
for.  Strings put in ' ' , function names and property names just put in
directly.

See this for some tips on this very point
http://coreplex.blogspot.com/2008/10/nant-tips-and-tricks-part-4-nant.ht
ml



-----Original Message-----
From: Nathan Franzen [mailto:nfran...@gmail.com] 
Sent: Tuesday, April 07, 2009 2:26 PM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] properties in functions

I'm coming to NAnt from an ant background, but I'm trying to adapt.
The documentation for
    <available/>
says that it's  deprecated & recommends using functions instead.

I prefer to parameterize as much as possible, so I wrote
    <if test="${not file::exists(${version-info-script})}">
        <fail message="version script ${version-info-script} not
available" />
    </if>

NAnt doesn't like this much:
      Unexpected token 'Dollar'.
      Expression: ${not file::exists(${version-info-script})}

I guess I am forced me to code the file name itself inside the
function call.   Is there another way?  Doing conditionals in ant is
ugly in a different way, admittedly.

-Nate

------------------------------------------------------------------------
------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to