I need to build my application in 'try-catch' section of nant config file, like this:
<trycatch>
<try>
<echo message="Start building MyApplication.."/>
<call target="BuildApp"/>
</try>
<catch>
<echo message="Build MyApp.sln is failed"/>
<fail/>
</catch>
</trycatch>
When build is failed it only shows the message: "Build MyApp.sln is failed", without any detailed information why it failed. How can I redirect build errors to 'catch' section and see the reason of failing?
You need to add the property
attribute to the catch
tag:
<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>
You could also forward the failure message via <fail message="${failure.message}" />
.