I am working on automating our build process and one of the things I am trying to do now is to add FxCop to the mix. There are a couple of ways to run the process, one using an exec task to call the executable directly, the other is through a Contrib task
I tried the first method with no success. For some reason I couldn’t get the output file name to be recognized by the executable. I eventually had to switch to the
<target
name="analyze.fxcop"
description="Runs FxCop on build output">
<setenv name="PATH" value="${tools.dir}\fxcop;%PATH%" />
<mkdir dir="${build.dir}\fxcop" />
<fxcop
directOutputToConsole="false"
analysisReportFilename="${build.dir}\fxcop\fxcop.xml"
failonerror="false">
<targets>
<include name="${build.dir}\release\bin\*.dll" />
</targets>
<dependencyDirectories refid="referenceComponents"/>
</fxcop>
</target>
A lot of work was involved just to find this out. Oh well, I got it working so now I share my results.