antnantnantcontrib

How to call a target when another target fails in NAnt?


I have two different tasks say A and B. If A fails I need to call B. How is it possible with NAnt.


Solution

  • I found a way, (for any one who goes across the same issue)

    <trycatch>
        <try>
            <call target="A" />
        </try>
        <catch>
            <call target="B" />
        </catch>
    </trycatch>