FxCop in CruiseControl.NET

来源:互联网 发布:藏头诗在线生成器软件 编辑:程序博客网 时间:2024/05/01 02:46

原文地址: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 said
We don't currently support running FxCop directly from CruiseControl.NET, but we plan on enabling this in a later release.
It seemed that the only way FxCop could be used with CC.NET is via NAnt.
However it turned out to be very easy to do it just viaExecutable Task. Here's what i did:
  1. Added FxCop project file to my solution (so i could select which assemblies to analyze and choose the rules)
  2. Added an exec task to project's tasks node in ccnet.config (after all the builds and unit tests are done)
  3. Added a File Merge Task to publishers node so that FxCop results are picked up by CC.NET
So the ccnet.config looks like this:
<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.