Integrating NCover code coverage with your CCNet CIS

I managed to read one more chapter in the CIS story. This one is called ‘Integrating NCover with CruiseControl’.
The CruiseControl documentation page has most of the help you need.
But NCover has always been a tricky one. If that page worked, I wouldn’t be writing this piece here.


  1. A CruiseControl.Net (I use v1.0.1) build server running all green. And you better be TDDing that code too…J.

  2. NAnt I use this (v 0.85) to build my code.

  3. NCover I use version 1.3.3 since that’s the only one there that still works with VS2003. Pick up 1.5.x for VS 2005.

Once you have all that in place, it’s time to get this started. To run NCover we need to add a task to our build file. It differs from the one on the CCNet doc page in the placement of the quotation marks. I found my solution by watching the Nant Build log on the CCNet dashboard

<exec program="l:\tools\NCover\ncover.console.exe" commandline="/w AT_Bin\Debug /c &quot;L:\Program Files\NUnit_227\bin\nunit-console.exe&quot; TestBearings.dll" />

Save that one. Now move onto the ccnet.config file. Add this to the tasks block of your project element there. We need this so that code coverage report is merged to the Nant build output file.


That’s it. Save and start a build. Hopefully that’s a green. Click on the green build link on the Recent Builds tab. Click on NCover report. You should be seeing something like this.

Now to find out why I don’t have 100% coverage J
Just that you know it is possible, If you have a different stylesheet for NCover results, rename and replace the stylesheet named

with your own. Hit F5 to refresh your browser and you should see the new results. Here I have use the default xsl that comes with NCover – although the CCNet version is more to the point. The one I mentioned in my earlier post is the best. I got an unexpected console listing at the top … but no big deal.

1 comment:

  1. I would really reccomend using a better xsl stylesheet to render the coverage results like the one here. It may be a few years old but it works for me.