Best Practices For Keeping NCover Running Smoothly

NCover Best PracticesNCover can collect coverage on any .NET application for development teams, QA teams and project teams. Several of the features that make NCover so useful within these organizations are its ability to collect and display coverage trends over time, aggregate coverage by various testing methods, and aggregate coverage across teams.  Although NCover is designed to handle large code coverage data sets, there are several best practices we recommend to keep NCover, your application and your coverage collection machines running at peak performance.

NCover Archive Best Practice

The NCover Archive command allows you to manage the size of active coverage data without the need to permanently delete data.

The Archive command is used to remove selected executions from the NCover GUI and store them in a compressed format.  As a best practice, we recommend automating this process to archive all data that is beyond the scope you regularly review.  The actual timeframe or number of executions to archive will depend on how often you collect coverage.

The NCover Archive command will:

  • Create zipped files for each selected execution.
  • Remove the selected executions from the NCover GUI.
  • Store the zipped files in a new folder called Archive in the “C:\ProgramData\NCoverData” folder

If you like, you can script the delete of the zipped files after they are created, or delete the entire Archive folder (which is created each time Archive is run, if it doesn’t exist).


NCover Archive --project=<name> [--execution=<execution match>]


NCover Archive --project="CodeBlaster" --keep-count=11


--project=VALUE**        NCover project name (REQUIRED).

--execution[=VALUE]**    Specify execution by Caption, Build Id, or Date.

--build-id, --buildid[=VALUE]** All executions matching Build Id

--keep-days[=VALUE]**    Keep <x> number of days of history.

--keep-count[=VALUE]**   Keep the most recent <x> number of executions.

--all**                  Archive all executions

NCover Verify & Repair Best Practice

 The NCover Verify command ensures your coverage data is complete and provides an option for repairing coverage data with errors.

NCover Verify can be run from the command line to review the data within a project to see if it is complete and can be queried. When exclamation marks in the Execution view of the NCover GUI indicate problems, the Verify command is always safe to run at any time.  However, as a best practice, we recommend using this command when you believe you have an error such as (1) an empty execution or (2) an execution in the GUI marked with an exclamation point.

The Verify command also has repair features:

  • Deletes empty executions which have zero captures.
  • Creates missing document tree and class paths if valid document or method nodes exist, but parents are missing.
  • Re-aggregates each execution and saves the execution to make sure indexes are correct.

Repair can be used on one execution, or specify –all to check the entire project.

If possible, backup the NCoverData directory before using –repair, as data may be altered during the process.


NCover Verify --project=<project>


  --project     NCover project name.  *REQUIRED*
  --execution   Specify execution by Caption, Build Id, or Date.
  --build-id, --buildid All executions matching Build Id
  --all                  Verify all executions
  --repair               If verify fails, attempt to remove errors.

NCover Data Store Management

 NCover provides users the ability to store coverage data at a specific location

The NCoverData folder location can be changed from its default location of “C:\ProgramData”:

  • Stop the NCover service (‘net stop ncover’ from the command line).
  • Edit the NCover.exe.config (located by default in C:\Program Files\NCover 4 [Application Name]).
  • Under the ncover.settings section of the config file, add or edit the dataStorePath element.
  • Specify the new NCoverData path (see example below).

Sample Config File

    <enableRequestCache >true</enableRequestCache>

Note: The NCover service will create the NCoverData folder and all subfolders in the location you specify.
You do not need to add “NCoverData” to the path.

  • Save the modified NCover.exe.config and restart the NCover service (‘net start ncover’ from the command line)


  1. […] Best Practices For Keeping NCover Running Smoothly (Kerry Meade) […]

  2. […] Best Practices For Keeping NCover Running Smoothly (Kerry Meade) […]