Jake,

You must not enclose properties in single quotes when using them in functions.

Use this 

<if test="${not file::exists(xsp)}" verbose="${debug}">

instead of

<if test="${not file::exists('xsp')}" verbose="${debug}">

The only function where you should enclose the property name in single quotes, 
is the property::exists(string) function as you do not want the property to be 
evaluated here.

If you want a more clean alternative to the <if> / <ifnot> tasks, I suggest you 
have a look at the NAntContrib <choose> task:

http://nantcontrib.sourceforge.net/nightly/latest/help/tasks/choose.html

Hope this helps,

Gert


>-----Original Message-----
>From: Jake Appelbaum [mailto:[EMAIL PROTECTED]
>Sent: Thursday, August 25, 2005 02:24 AM
>To: nant-users@lists.sourceforge.net
>Subject: [Nant-users] A mistake in my config or a bug in nant?
>
>Hi all,
>
>I'm attempting to automatically set a variable depending on a
>conditional test. I'm using <ifnot> and <if> for this.
>
>The documentation here is out of date (I guess that's a known issue?):
>http://nant.sourceforge.net/release/latest/help/tasks/ifnot.html
>http://nant.sourceforge.net/nightly/latest/help/tasks/ifnot.html
>
>It suggests using an opening <ifnot> and a closing </if> tag. Unless I'm
>mistaken, that didn't work for me. I used a normal <ifnot></ifnot> or
><if></if>. In any case, it still failed to correctly set the property to
>the value of a binary on the system.
>
>Here's my example code for auto detecting a given binary. This method
>uses <if> and 'test':
>
><property name="xsp" value="/opt/mono-current/lib/xsp/1.0/xsp.exe"/>
>
>        <if test="${not file::exists('xsp')}" verbose="${debug}">
>
>                <echo message="xsp was: ${xsp}"/>
>                <property name="xsp"
>value="/usr/share/dotnet/bin/xsp.exe"/>
>                <echo message="xsp is: ${xsp}"/>
>
>        </if>
>
>        <if test="${not file::exists('xsp')}" verbose="${debug}">
>
>                <echo message="xsp was: ${xsp}"/>
>                <property name="xsp"
>value="/opt/mono-2005-08-07_00//lib/xsp/1.0/xsp.exe"/>
>                <echo message="xsp is: ${xsp}"/>
>
>        </if>
>
>This method uses <ifnot> with 'test' again:
>
>        <property name="wsdl"
>value="/opt/mono-2005-08-07_00/lib/mono/1.0/wsdl.exe"/>
>
>
>        <ifnot test="${target::exists('wsdl')}" verbose="${debug}">
>
>                <echo message="wsdl was: ${wsdl}"/>
>                <property name="wsdl"
>value="/usr/lib/mono/1.0/wsdl.exe"/>
>                <echo message="wsdl is: ${wsdl}"/>
>
>        </ifnot>
>
>        <ifnot test="${target::exists('wsdl')}" verbose="${debug}">
>
>                <echo message="wsdl was: ${wsdl}"/>
>                <property name="wsdl"
>value="/opt/mono-2005-08-07_00/lib/mono/1.0/wsdl.exe"/>
>                <echo message="wsdl is: ${wsdl}"/>
>
>        </ifnot>
>
>In either method, the last property tag for xsp is set to the last
>property assignment. The same happens with wsdl. In both cases there is
>no binary at that location on the given machine. The properties are
>simply assigned and it appears they're simply not checked.
>
>Am I mistaken in how I assume ifnot and if are supposed to work?
>Is there a better way to do what I'd like to do? Something that can
>check that it's an actual executable binary?
>
>Should I file a bug and/or is there any information I could give that
>would help in resolving this issue?
>
>I'm using a debian package with version: NAnt 0.85 (Build 0.85.1932.0;
>rc3; 4/16/2005) and a nightly build with version: NAnt 0.85 (Build
>0.85.1747.0; mono-1.0.unix; dev; 10/13/2004).
>
>Is this a known issue with these versions? I read the change logs and I
>didn't see a fix but it's entirely possibly I've overlooked a fix...
>
>-- 
>Jake Appelbaum <[EMAIL PROTECTED]>
>
>
>
>-------------------------------------------------------
>SF.Net email is Sponsored by the Better Software Conference & EXPO
>September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
>Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
>Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
>_______________________________________________
>Nant-users mailing list
>Nant-users@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/nant-users
>
>




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to