James Jackson wrote:
Hi,

I’m calling FxCop as a Nant task, and want the build to fail if it returns any errors. However, setting failonerror=”true” does break the build, but then doesn’t complete the remaining tasks in Nant (calling Nunit) or Cruise Control (merging the XML outputs). Is there any way to get the build to be reported as failed on FxCop failure, but complete the rest of the build commands?

Cheers,

James.



You can use the <trycatch> task from nantcontrib and the <fail> task from nant like this:

<trycatch>
        <try>
                ... stuff ...
        </try>
        <catch>
                <!-- something failed so record it-->
                <property name="fxcop-failed" value="true"/>
        </catch>
</trycatch>

... more stuff ...

<fail message="FxCop failed" if="${fxcop-failed}"/>


Ashley


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to