我在集成CruiseControl与FxCop的时候,由于搜索到的资料差异,前面还转载了一篇文章其中通过bat文件来配置的,在配置时也可进行参考。我是通过exec块来进行配置的。过程中参考了一位老外的经验贴,最终实践成功了。需要配置的文件同样有三(与Gendarme一样)。
A.ccnet.config(C:\Program Files\CruiseControl.NET\server)
B.dashboard.config(C:\Program Files\CruiseControl.NET\webdashboard)
C.packages.xml(C:\Program Files\CruiseControl.NET\webdashboard\packages)
++++++++++++++++++++分别介绍每个文件的配置方法的分割线++++++++++++++++++++++++++
1.FxCop在ccnet.config文件中的配置
在ccnet.config文件中的<task></task>块中加入以下内容:
<exec>
<executable>C:\Program Files\Microsoft FxCop 1.35\FxCopCmd.exe</executable>
<baseDirectory>D:\myproject\dll</baseDirectory>
<buildArgs>/p:"D:\artificial\MS.FxCop" /out:"FxCop-results.xml"</buildArgs>
<buildTimeoutSeconds>36000</buildTimeoutSeconds>
</exec>
<merge>
<files>
……
<file>D:\ECMS\UI\XSTLogin\bin\Debug\FxCop-results.xml</file>
<!-- Other files to merge for your build would also be included here -->
</files>
</merge>
2. FxCop在dashboard.config文件中的配置
<buildPlugins>
<buildReportBuildPlugin>
<xslFileNames>
<xslFile>xsl\fxcop-summary_1_36.xsl</xslFile>
</xslFileNames>
</buildReportBuildPlugin>
<buildLogBuildPlugin />
<finalBuildStatusPlugin />
<xslReportBuildPlugin description="FxCop Report" actionName="FxCopBuildReport" xslFileName="xsl\fxcop-report_1_36.xsl"/>
</buildPlugins>
3.FxCop在package.xml文件中的配置
<package name="FxCop Results" description="Display the results of a FxCop build." type="Plugin" file="FxCop.zip" installed="yes" />
确保此行中的installed = "yes"即可。
另外,我发现,Fxcop如果分析的DLL文件某些依赖的文件没添加进来,总是会失败,加上那些依赖项才会运行正确。
FxCop在工作的截图:
完!