我需要在 nant 配置文件的“try-catch”部分构建我的应用程序,如下所示:
<trycatch>
<try>
<echo message="Start building MyApplication.."/>
<call target="BuildApp"/>
</try>
<catch>
<echo message="Build MyApp.sln is failed"/>
<fail/>
</catch>
</trycatch>
当构建失败时,它只显示消息:“Build MyApp.sln is failed”,没有任何失败原因的详细信息。如何将构建错误重定向到“catch”部分并查看失败的原因?
最佳答案
您需要添加property
属性为catch
标签:
<trycatch>
<try>
<echo message="Start building MyApplication.."/>
<call target="BuildApp"/>
</try>
<catch property="failure.message">
<echo message="Build MyApp.sln is failed"/>
<echo message="Failure message: ${failure.message}"/>
<fail />
</catch>
</trycatch>
您也可以通过 <fail message="${failure.message}" />
转发失败消息.
关于nant - 如何将 nant 构建错误重定向到 'catch' 部分?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13578870/