Integrate NDepend with CruiseControl.NET

For the best support, use CruiseControl.NET version 1.5 and above.

Starting with version 3.5, NDepend provides rich and easy to browse HTML+javascript reports. To enable them in the CruiseControl.NET dashboard, follow these steps

Configuring the Server (ccnet.config)

The xccnet.config file under the /server directory of the ccnet install, describes the integration process. To enable NDepend analysis, you can use the ccnet built-in NDepend task as follow:

< cruisecontrol >
< queue />
< tasks >
<!-- other tasks to run -->
< ndepend>
< project > ..\myProject.ndproj</ project >
< executable > C:\tools\ndepend\NDepend.Console.exe </ executable >
< description > Run the NDepend analysis. </ description >
< emitXml > true</ emitXml >
< outputDir > NDepend</ outputDir >
< inputDirs >
< inputDir > ..\myProject\bin\Debug</ inputDir >
</ inputDirs >
< silent > false</ silent >
< reportXslt > custom-report.xsl </ reportXslt >
< timeout > 120</ timeout >
< baseDir ></ baseDir >
< publish > true</ publish >
</ ndepend >
 
</ tasks >
</ cruisecontrol >

Please refer to the ccnet documentation for the full help on this task. You'll find below some clarifications:

  • Project: the path to the ndepend project file (.ndproj) describing the analysis. The path can either be absolute or relative (to the working directory of ccnet or to the baseDir specified)
  • Executable: the path to the ndepend console binary. You need a working license in the ndepend directory for it to work.
  • InputDirs: a list of directories where ndepend will look for the assemblies to analyze. These are mandatories since the original ndepend project references absolute paths which are not likely to be the same on the build machine. The paths can either be absolute or relative (to the working directory of ccnet or to the baseDir specified)

Once the ccnet server is set up to run NDepend analysis, we now have to set up the web dashboard for the reports to show...

Setting up the NDepend Report in the CruiseControl.NET Dashboard

Starting with CruiseControl.NET 1.5, you can embed arbitrary reports in the ccnet dashboard. In order to use that feature, take the following steps.

Under the /webdashboard directory below the root install of ccnet, edit the dashboard.config file, look for the <buildPlugins> element and add the following element:

<? xml version = " 1.0 " encoding =" utf-8 "?>
< dashboard >
< remoteServices />
< plugins >
< farmPlugins />
< serverPlugins />
< projectPlugins />
< buildPlugins >
< buildReportBuildPlugin />
< buildLogBuildPlugin />
< htmlReportPlugin
description = "NDepend Report"
actionName = "ndepend"
htmlFileName= "NDepend\NDependReport.html" />
</ buildPlugins >
<securityPlugins />
</ plugins >
</ dashboard >

(non relevant configuration elements have been omitted…)

  • description: the label of the link to the report in the dashboard
  • htmlFileName: a path to the NDepend output directory defined in ccnet.config above

If everything is configured correctly, you should see the following result:

ndepend cruise control dotnet integration