The NCover RUN Command

Remember in my post last week how I said that we had more functionality coming to make life easier for you? Here it is!

The RUN Command

Last week’s post described the USE and SUMMARIZE commands. The RUN command combines these two commands into a single command that sets up an environment to collect coverage on a particular command line. You can specify the project and build id (either as arguments or environment variables) just as in the USE command, but now you can pass a command line for NCover to run (similar to how NCover 3 worked). The token ‘--‘ marks the end of arguments that should be passed to NCover and the beginning of the command line to run. NCover will run the specified command line and then print a summary, just like the SUMMARIZE command. You can fail a build with the --fail-build option, and you can also set the working directory with the --working-dir= option.

So the commands from last week’s post can be combined into a single command like this:

ncover run --project="MyProject" --buildId="$(build-id)" -- nunit-console.exe mytests.dll

This will run nunit-console.exe and place the coverage data into MyProject, giving the resulting execution the build ID $(build-id), which represents a build system variable. After the tests finish, a summary will be printed.

You can always use the USE and SUMMARIZE commands to gain more control in your build scenario. This command is another way for us to help make the transition from NCover 3 to NC4 as simple as possible for you.


  1. […] *UPDATE* – If you’re looking for a simpler way to accomplish the functionality provided by the USE and SUMMARIZE commands, read about the RUN command here. […]