如何在nant.onfailure中获取错误消息

如何在nant.onfailure中获取错误消息,nant,Nant,我试图在nant.onfailure中获取生成的失败消息。我知道我可以使用try/catch,但我想避开这条路线。是否可以在不使用try/catch的情况下获取失败消息?我不确定您是否知道NAntContrib库 您可以包括他们的库以获得额外的“任务”。我目前正在使用名为“记录”的任务来记录成功和失败,而无需任何尝试/捕获 大概 <property name="Build.FailureLog" value="C:\TestLog.txt" /> <!-- Start th

我试图在
nant.onfailure
中获取生成的失败消息。我知道我可以使用
try/catch
,但我想避开这条路线。是否可以在不使用try/catch的情况下获取失败消息?

我不确定您是否知道NAntContrib库

您可以包括他们的库以获得额外的“任务”。我目前正在使用名为“记录”的任务来记录成功和失败,而无需任何尝试/捕获

大概

<property name="Build.FailureLog" value="C:\TestLog.txt" />

<!-- Start the listener record -->
<record name="${Build.FailureLog}" level="Verbose" action="Start" />
<property name="nant.onfailure" value="Failure" />

<target name="Failure" description="This target is called upon when the build has failed." >
    <!-- Close the listener -->
    <record name="${Build.FailureLog}" action="Close" />

    <!-- Additionally you could send emails by including in mail -->
</target>