KILIÇ.NET

NAnt and FxCopCmd

Today I spent some time in between NAnt and FxCop, and by the sheer size of the output log file, I think I'll be in here for sometime yet.

To run FxCop through NAnt all that was required was a new target section with a containing exec task. Here's the code for better illustration:

<target name="fxcop" description="Runs FxCop and outputs results to fxcop.xml">

<exec program="FxCopCmd.Exe"

commandline="/file:${BaseDir}\bin\MeetMeAtStarbucks.dll /rules:${PathToFxCop}\Rules /out:${BaseDir}\fxcop.xml"

basedir="${PathToFxCop}" />

</target>

he properties ${BaseDir} and ${PathToFxCop} consecutively contain the project path and the path to the FxCop folder. You can see that I've used the FxCopCmd.exe tool instead of the GUI based FxCop.exe.

I wrote a quick XSL to style the generated output XML file which you can find here along with a simple VBS file that would do the transformation and create an HTML page.