Search code examples
c#visual-studiovisual-studio-2013code-metricsrunsettings

Exclude test code from code metrics


Is it at all possible to exclude Class Libraries or code files from code metrics? I cannot find good resources on this as they all seem to focus on Code Coverage, which can be set in a .runsettings file.

I would like to have a build without warnings on lines-of-code on test projects.


Solution

  • Apparently, there is a Files to ignore field on the build template, which I haven't noticed for months:

    Code Metrics > Files to ignore.
    

    This takes a regular expression, so I can just put:

    *.Tests.dll
    

    This excludes my test libraries.