Question

I am using Testdriven.net to run NCover on my assemblies. However, I need to exclude certain methods from the coverage report. How can I do this?

Was it helpful?

Solution

This can be achieved by declaring an Attribute named CoverageExcludeAttribute in the global (sometimes referred to as the empty) namespace and applying this Attribute on the methods you want excluded from NCover.

NCover will pick up this attribute by its name only, so there's no need to reference any external assemblies. See also this post. (It doesn't mention that the CoverageExcludeAttribute must be defined in the global namespace).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top