Run NDepend as part of your integration
Initial NDepend setup
In order to get the results of NDepend included in the CruiseControl.NET build results, you will need to setup a NDepend project file that includes information about which Assemblies to analyse and which types of analysis to do. NDepend comes with a GUI application called VisualNDepend that can create project files.
For more information see the demos at the NDepend site, http://www.ndepend.com/VisualNDepend.aspx. Additional information can also be found at http://codebetter.com/blogs/patricksmacchia/archive/2008/12/14/increase-build-process-added-value-with-static-analysis.aspx.
Run NDepend as part of your NAnt build
Once you have the project file, you need to include a call to NDepend.Console.exe in your NAnt build file and pass it the name of the NDepend project file. We recommend you use a target like this, with paths relative to the location where NAnt was run from:
<target name="-run-ndepend" >
<exec program="Tools\BuildMetrics\NDepend\NDepend.Console.exe">
<arg value="Tools\BuildMetrics\NDepend\MyProject.NDependProject.xml" />
<arg value="/Silent" />
</exec>
</target>
Run NDepend as a CruiseControl.NET Task
NDepend can also be run directly from CruiseControl.NET. This also includes a number of extra steps, including publishing the results and merging.
The following is a minimal example of how to include this task:
<ndepend>
<project>NDepend-Project.xml</project>
</ndepend>
Further details on this task is available at NDepend Task.
Note: This task is only available in versions 1.4.4 or later of CruiseControl.Net.
Merge NDepend results into your CruiseControl.NET results
If the analysis was run from NAnt, the next step is to merge the NDepend report files into the integration result using the File Merge Task. If the NDepend Task is being used, this step is done automatically for you.
Your CruiseControl.NET Server config file will have something in it like :
<tasks>
<merge>
<files>
<file>d:\sourceforge\ccnet\build\log\unit-test.xml</file>
<file>d:\sourceforge\ccnet\build\log\NDependOut\ApplicationMetrics.xml</file>
<file>d:\sourceforge\ccnet\build\log\NDependOut\AssembliesBuildOrder.xml</file>
<file>d:\sourceforge\ccnet\build\log\NDependOut\AssembliesDependencies.xml</file>
<file>d:\sourceforge\ccnet\build\log\NDependOut\AssembliesMetrics.xml</file>
<file>d:\sourceforge\ccnet\build\log\NDependOut\CQLResult.xml</file>
<file>d:\sourceforge\ccnet\build\log\NDependOut\InfoWarnings.xml</file>
<file>d:\sourceforge\ccnet\build\log\NDependOut\NDependMain.xml</file>
<file>d:\sourceforge\ccnet\build\log\NDependOut\TypesDependencies.xml</file>
<file>d:\sourceforge\ccnet\build\log\NDependOut\TypesMetrics.xml</file>
</files>
</merge>
</tasks>
Configuring your Reporting Application to display NDepend results
If you are using the Web Dashboard, the most straightforward way to include this report in the dashboard is import and install the NDepend package. This requires the Dashboard Administration Plugin to be installed and configured correctly. If this is not installed, then it is possible to manually install the report.
The report can be manually installed by copying the xsl file to the same location as the default xsl files, which should be <webdashboard folder>\xsl. Then, edit your dashboard.config file and include the ndependreport-ccnet.v2.xsl file under the <dashboard>/<plugins>/<buildPlugins>/<buildReportBuildPlugin>/<xslFileNames> section like:
<xslFile>xsl\ndependreport-ccnet.v2.xsl</xslFile>
Also add the following to the <dashboard>/<plugins>/<buildPlugins> section as:
<xslReportBuildPlugin description="NDepend Report" actionName="NDependBuildReport" xslFileName="xsl\ndependreport-ccnet.v2.xsl" />
The XSL file (ndependreport-ccnet.v2.xsl) is included in the XSL folder under the dashboard in a normal install. An alternate version can be found in the NDepend distribution: <ndepend distribution>\CruiseControl.NET\ndependreport-ccnet.v2.xsl.
Note: Previous versions (prior to 1.4.4) had an issue where the images could not be displayed. Starting with version 1.4.4 of CruiseControl.Net, this issue has been resolved.