How to add filters to OpenCover tool to skip some of the classes in a namespace

Ravindra picture Ravindra · Jul 26, 2011 · Viewed 13.6k times · Source

How can I add filters to skip some of the classes in a namespace/assembly. For example: SYM.UI is the base assembly and i want to skip SYM.UI.ViewModels. Writing the below filter but it is including all of them and not fulfilling my request:

+[SYM.UI*]* -[SYM.UI.ViewModels*]*

Kindly help me correcting this?

Answer

Shaun Wilde picture Shaun Wilde · Jul 27, 2011

The opencover wiki is a good place to start.

The usage is described as +/-[modulefilter]typefilter (this is based on how you would see the types in IL; where the type filter also includes the namespace and module filter usually is the name of the assembly (without the file extension).

Thus to exclude your types you could use

+[SYM.UI]* -[SYM.UI]SYM.UI.ViewModels.*

NOTE: Exclusion filters take preference over inclusion filters.