For example I have three tasks: task1, task2, task3. How to write a CruiseControl.NET configuration file that runs task3 but only after task2 ends with success?
I'd suggest you do that inside your NAnt or MSBuild task instead, and move it out of your CruiseControl.NET configuration.
What do your tasks do? Any reason you can't move them inside your NAnt or MSBuild script?
I would recommend a script file (bat, PowerShell) where you run the tasks and check for success.
Depending on what you are trying to accomplish, this can be done pretty easily in 2 ways:
A) CruiseControl.NET supports what is referred to as projectTriggers:
In order to use this approach, each task needs to be isolated into their own project configuration. Basically, the task3 project monitors the build status of the task2 project. When the task2 project successfully completes, the task3 project triggers a build. To setup a projectTrigger, edit your task3 project definition in ccnet.config and create a trigger block as follows:
<triggers>
<multiTrigger>
<triggers>
<intervalTrigger seconds="30" />
<projectTrigger project="task2">
<triggerStatus>Success</triggerStatus>
</projectTrigger>
</triggers>
</multiTrigger>
</triggers>
B) Setup the order of your tasks using Nant targets instead:
As pointed out by Wim, you may want to consider breaking the tasks out into Nant targets instead of trying to do it in the ccnet.config. Personally, I find this approach more comfortable only because I know Nant is good at doing just this sort of thing.
CruiseControl.NET v1.5 enhances the execution of tasks using their new Sequential and Parallel tasks...
http://confluence.public.thoughtworks.org/display/CCNET/Sequential+Task
<sequential continueOnFailure="false">
<description>Example of how to run multiple tasks in sequence.</description>
<tasks>
<!-- Tasks defined here -->
</tasks>
</sequential>