I think that the 'foreach' task would be closer to what you are looking for. It would probably be easier to implement the 'while' task starting from 'foreach'.
Noel -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris Lambrou Sent: Tuesday, August 29, 2006 4:05 AM To: nant-users@lists.sourceforge.net Subject: [NAnt-users] Conditional looping within a NAnt script (is there a'while' task?) Hello all, I'm looking for a way to perform conditional loops in a Nant script. Essentially, I'd like to repeat a section of script whilst a condition remains true. Nant doesn't appear to have any tasks or other script elements that support this behaviour, so I thought I'd try to implement my own 'while' task, by extending the existing 'if' task, thus: [TaskName("while")] public class WhileTask : IfTask { protected override void ExecuteTask() { while (ConditionsTrue) { //this is the only line that I've changed - use while instead of if base.ExecuteTask(); } } } Unfortunately, this doesn't work, as the condition is only evaluated once rather that being evaluated each time through the while loop. Although I've had a good look through the Nant source code, I'm afraid I'm getting a little lost, as it's all rather new. Does anyone know how I can cause the expression to be evaluated each time through the while loop, or have any other suggestions as to how the desired conditional looping behaviour can be achieved? I looked briefly at the LoopTask (the foreach task), but it evaluates the elements to be looped over up-front, rather than during the iteration, so itn't obviously much help. Many thanks, Chris ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ NAnt-users mailing list NAnt-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-users ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ NAnt-users mailing list NAnt-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-users