Do you want the email when a particular TARGET fails or when a particular
TASK fails?  Either way, try this...
No guarantee that this will definitely work, but if the behavior of the
"nant.failure" target is the same as the regular targets this should work.

<project>
        <property name="sendEmail" value="false">
        <property name="nant.failure" value="emailMe" />
        <!-- To email when a TARGET fails,
        set the flag at the beginning and
        end of the target. -->
        <target name="targetThatMightFail">
                <property name="sendEmail" value="true">
                do all target tasks...
                <property name="sendEmail" value="false">
        </target>
        <!-- To email when a TASK fails,
        set the flag before and after
        the specific task. -->
        <target name="anotherTarget">
                target tasks...
                <property name="sendEmail" value="true">
                do task that might fail
                <property name="sendEmail" value="false">
                target tasks...
        </target>
        <target name="emailMe" if="${sendEmail}">
                do email tasks...
        </target>
</project>

Peter

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
[EMAIL PROTECTED]
Sent: Thursday, July 03, 2003 13:29
To: [EMAIL PROTECTED]
Subject: [Nant-users] Conditional Actions on build failure


Hi,

How do you get NANT to send an EMAIL if an NUnit 2.0 test fails?  I can get
the email task working but I don't know how to make it conditional on the
test failure.  Is there a way?

Regards,

David Taylor
Extension: 4496
Email:       [EMAIL PROTECTED]
Mobile:     +44 7966 490138





-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Nant-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to