CruiseControl.Net 與 FxCop 集成

我在集成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在工作的截圖:


完!微笑

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章