MSBuild task for automating NCover.Console.exe, with NCover 1.5.x support. Note that this task will self register CoverLib.dll by default using the registry (does not require local admin).
For a list of all members of this type, see NCover Members.
System.Object
Task
ToolTask
NCover
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
This example shows the standard profiling using NCover for standard nunit tests with minimal arguments. Defaults are with logging to coverage.log, profiling all assemblies, output filename of coverage.xml and this example specifies a path to where to find ncover.console.exe.
<NCover ToolPath="Tool\NCover\" CommandLineExe="$(nunit.path)\nunit-console.exe" CommandLineArgs="$(MSBuildProjectDirectory)\myapp.tests.dll" />If you are using TypeMock, you may experience issues with the registration of coverlib.dll conflicting due to overwriting the registered profiler. You should add the "registerProfiler" attribute below and set it to false.
<NCover ToolPath="Tool\NCover\" CommandLineExe="$(nunit.path)\nunit-console.exe" CommandLineArgs="$(MSBuildProjectDirectory)\myapp.tests.dll" RegisterProfiler="false" />This example for NCover 1.5.8 shows profiling a process which is launched by another process.
<NCover ToolPath="Tool\NCover\" CommandLineExe="MyLauncher.exe" ProfiledProcessModule="LaunchedProcess.exe" />This example shows using an assembly list as ; delimited names rather than using the ability of the NCover task to dynamically build from a list of files (shown in following example).
<NCover ToolPath="Tool\NCover\" CommandLineExe="$(nunit.path)\nunit-console.exe" CommandLineArgs="$(MSBuildProjectDirectory)\myapp.tests.dll" AssemblyList="MyApp.Core;MyApp.Tests" />This example shows the standard profiling using NCover 1.5.x for a Windows application, specifying a coverage exclusion, verbose logging to a named file, specifically named log and output xml files. It also shows coverage exclusion attributes, overriding the NCover location to run from and a way of listing assemblies to be included in the profiled NCover results.
<ItemGroup> <Assembly Include="$(MSBuildProjectDirectory)\MyApp.MyCode.dll" /> </ItemGroup> <NCover ToolPath="Tool\NCover\" CommandLineExe="$(nunit.path)\nunit-console.exe" CommandLineArgs="myapp.tests.dll" CoverageFile="myapp.coverage.xml" LogLevel="Verbose" LogFile="myapp.coverage.log" WorkingDirectory="$(MSBuildProjectDirectory)" ExcludeAttributes="CoverageExcludeAttribute" Assemblies="@(Assembly)" />
Namespace: NCoverExplorer.MSBuildTasks
Assembly: NCoverExplorer.MSBuildTasks (in NCoverExplorer.MSBuildTasks.dll)
NCover Members | NCoverExplorer.MSBuildTasks Namespace