原文地址:http://blog.webgear.co.nz/archive/2008/07/25/fxcop-in-cruisecontrol.net.aspx
I have finally integrated FxCop into my automated build process. Now i can see FxCop summary and detailed reports on theCruiseControls.NET dashboard.
Initially I was misguided somewhat by CruiseControl.NET's documentation when it saidHowever it turned out to be very easy to do it just viaExecutable Task. Here's what i did:
- Added FxCop project file to my solution (so i could select which assemblies to analyze and choose the rules)
- Added an exec task to project's tasks node in ccnet.config (after all the builds and unit tests are done)
- Added a File Merge Task to publishers node so that FxCop results are picked up by CC.NET
<cruisecontrol>
<project name="project">
...
<tasks>
...
<exec>
<executable>C:\Program Files\Microsoft
FxCop 1.35\FxCopCmd.exe</executable>
<baseDirectory>C:\AllProjects\MyProject\</baseDirectory>
<buildArgs>/p:"MyProject.sln.FxCop"
/out:"(artifacts)\FxCop-results.xml" /gac</buildArgs>
<buildTimeoutSeconds>300</buildTimeoutSeconds>
</exec>
</tasks>
<publishers>
<merge>
<files>
<file>(artifacts)\FxCop-results.xml</file>
</files>
</merge>
...
</publishers>
</project>
</cruisecontrol>
(Note i have added some linebreaks in there so it fits into the page).I'm also using different stylesheets to present FxCop results, which i think are nicer.