Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.
juancentro edited this page Apr 19, 2012 · 41 revisions

There is only a console option which has the following options.

-? - show help

or

-target:<path to target> - the target application

the following arguments are optional

-targetdir:<target directory> - the directory to execute the target application in

-targetargs:<target arguments> - the arguments to pass to the target application in

-register[:user] - dynamically register the profiler, use "user" if current user does not have admin rights. Alternatively preregister the profiler using regsvr32.exe

-mergebyhash - used to merge assembly results by their file hash (mainly used for MSTest users)

-output:<output file> - the name of the output file

-filter:<filters> - filters to employ to limit the scope of the coverage. Using PartCover syntax, where (+|-)[Assembly-Filter]Type-Filter
i.e.
+[Open*]* include all types in assemblies starting with Open,
-[*]Core.* exclude all types in the Core namespace regardless of the assembly. If no filters are supplied then the default inclusive filter +[*]* is applied automatically.
NOTE: Multiple filters can be applied by separating them with spaces and enclosing them with quotes i.e. -filter:"+[*]* -[A*]Name.*" .
NOTE: Exclusion filters take precedence over inclusion filters.

-nodefaultfilters - do not apply the default exclusion filters -[System]*, -[System.*]*, -[mscorlib]* and -[Microsoft.VisualBasic]*

-returntargetcode - set the DOS errorlevel to the errrorlevel returned by -target.

Finally the following notes apply to all arguments that may have spaces.
NOTE: If your argument requires spaces then use quotes i.e. -targetargs:"arg1 arg2 arg3"
NOTE: If your argument needs to escape quotes i.e. to pass arguments with spaces to that target process then you can use \"
i.e. -targetargs:"\"c:\program files\" xyz"
NOTE: When using PowerShell and your argument requires spaces then the quotes must be before the argument name i.e. "-targetargs:arg1 arg2 arg3". Interestingly this format can be used for a command file as well.
NOTE: If you are using NUNit to run your tests, NUnit is your target application. The dll that contains the unit tests fro the Application Under Test (AUT) goes in the targetargs argument because NUnit is responsible for running it. Example: OpenCover.Console.exe -target:"C:\Program Files (x86)\NUnit 2.6\bin\nunit-console.exe" -targetargs:"/nologo /noshadow C:\AUT\Ihavethetests.dll" - filter:"+[*]* -[Ihavethetests*]* -register:user