Wednesday, August 08, 2007

NAnt - Error Handling

When an error occurs in a NAnt process, we can execute an error handling task. We only need to set "nant.onfailure" property to point to valid target element in the build file.

Example:

<property name="nant.onfailure" value="myproject.error" />

<target name="myproject.error">
  <call failonerror="false" target="myproject.error.deletetempfiles" />
  <call failonerror="false" target="myproject.error.deletetestcertificates" />
  <call failonerror="false" target="myproject.error.deletesettings" />
</target>

No comments: