NAnt Integration

<ncover> task

Instruments c# code with coverage code.
This task should be run prior to compilation and tests being run.
Line numbers of the instrumented code remain the same.

As with all code instrumentation products, run the ncover task against a copy of your source code, not the originals. Your originals should be kept safe in a source control system.

To load the task add in this line to your initialisation target in your NAnt build file:

<loadtasks assembly="NCover.dll" />

Attribute Type Description Required
publishDir string Directory to output the expected coverage points that should be hit. The default is Project.BaseDirectory/expectedCoverage.xml. False
reportname string Name for this set of instrumentions. False

Nested Elements


The set of source files to instrument (a FileSet). Required. Use includes / excludes to select the set of files you wish to establish the test coverage against. Typically this fileset would include all production source files and exclude the test source files.
A file called NCoverCheck.cs is writen to the source directory. The code coverage will work across separate exes and dlls, as long as the file is included in each csc tast's <sources> element.


	<sourcefilestoinstrument basedir=".\instrumentedSrc\">
		<includes name="**/*.cs"/>