This page last changed on Dec 17, 2006 by dcameron.

Run NDepend as part of your integration

Run NDepend as part of your NAnt build

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 analyze and which types of analysis to do. NDepend comes with a NDepend.Project GUI application to create project files. For more information see the demos at the NDepend site, http://www.ndepend.com/NDependProject.aspx.

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

We don't currently support running NDepend directly from CruiseControl.NET.

Merge NDepend results into your CruiseControl.NET results

The next step is to merge the NDepend report files into the integration result using the File Merge Task. 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>
            <!-- Add your NDepend report files as follows -->
            <file>d:\sourceforge\ccnet\build\log\NDependOut\ApplicationMetrics.xm3l</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

For displaying the results, the NDepend distribution includes a default stylesheet for use with CC.NET. It is in the NDepend distribution at <ndepend distribution>\CruiseControl.NET\ndependreport-ccnet.v2.xsl

If you are using the Web Dashboard, the most straightforward way to include this report in the dashboard is to copy 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" />

Unfortunately, because of limitations in CruiseControl.NET, the images that NDepends generates will not be available from the dashboard. This is a limitation we hope to overcome in a future version. However, until that work has been done it is possible to work around the limitation. Robin Curry explains his approach at his blog, http://www.robincurry.org/blog/IntegratingImagesIntoCustomCruiseControlNETBuildReports.aspx. He also has another explanation of integrating NDepend in to a CruiseControl.NET build at http://www.robincurry.org/blog/IntegratingNDependCodeMetricsIntoAnNAntCruiseControlNETBuild.aspx. This would also appear to require manual editing of the ndependreport-ccnet.v2.xsl file.

Document generated by Confluence on Mar 14, 2009 02:55