Getting FxCop violations to cause a build failure

I'm using fxcopcmd.exe 1.35 as a post-build event and I want any FxCop violation to cause the build to fail. I know that the ability to treat FxCop warnings as build errors is limited to the FxCop that comes with VS 2005. I've been working around this limitation by checking for the existence of a Xml report file after each FxCop run. If the file exists, violations occurred. Otherwise, the code is clean. I'm just wondering if there's a simpler way to determine if violations occurred.

Answer this question

Getting FxCop violations to cause a build failure

  • MmmBeer

    Hi Craig,

    Checking for the existence of an output report is the recommended way to go. Alternatively you can add an extra step with a small app/task that parses the output log for existence of violations of certain rules. The Xml subdirectory of FxCop contains an xsd for the FxCopReport format.

    Regards,

    Jeffrey


  • Getting FxCop violations to cause a build failure