Well, I'm a NAnt newbie myself, but I can give you some pointers.

The ${...} construct is used to evaluate an expression, not just get the
value of a property.

So, you want something like this:

<if test="${ property::exists('ccnet.buildcondition') and
ccnet.buildcondition='ForceBuild'}">
  ...
</if>

Hope this helps,
Bevan.



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Noel Llopis
Sent: Thursday, 10 February 2005 7:53 a.m.
To: nant-users@lists.sourceforge.net
Subject: [Nant-users] Conditions on a property value?

I'm very new to Nant, so this might be obvious, but how exactly can I do
conditional things based on the *value* of a property?

I've seen the <if> task
(http://nant.sourceforge.net/release/latest/help/tasks/if.html), and it
seems I can do just about anything except for check the value of the
property.

Towards, the bottom, there's a brief mention of the test parameter, but
it
doesn't work at all for me:

<if test="${ccnet.buildcondition}='ForceBuild'">
           <property name="build" value="rebuild"/>
</if>

This complains that an if task always needs a propertyexist or some
other
one. If I add propertiexists on top of test, test is ignored and the
condition of <if> appears to be always true.

I also tried doing

<property name="build" value="build"
if="${ccnet.buildcondition}='ForceBuild'"/>

but it claims that the expression in the if statement is not valid and
it
doesn't know how to compare it.

This has to be really trivial. Any idea?
Thanks!


--Noel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users




******************************************************************************
"This message (and any files transmitted with it) are confidential and 
may be legally privileged. If you are not the intended recipient please
notify the sender immediately and delete this message from your system.

This message does not necessarily reflect the views of the
Reserve Bank of New Zealand. If the recipient has any concerns
about the content of this message they should seek alternative
confirmation from the Reserve Bank of New Zealand."
******************************************************************************





-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to