views:

66

answers:

1

I have a Visual Studio 2010 .NET 4 solution with C# projects and a C++/CLI project.

I use Visual Studio's built in unit tests and code coverage.

Other than the fact that Visual Studio 2010 coverage tool for C++/CLI projects seems to be much weaker than Visual Studio 2008 coverage tool, I get weird results.

For example, I get uncovered code in this file:

c:\program files (x86)\microsoft visual studio 10.0\vc\include\xstring

And some other files in that directory.

I want to exclude this code from coverage results.

Is there a way to put some exclude attributes on that code? If not, is there a different automatic way to exclude that code from coverage? If not, is there a way to use EXCLUDE option to exclude it? Can it be done automatically within Visual Studio without running the coverage tool from command prompt?

Any other solutions?

+1  A: 

Well, the MSDN documentation you linked to says:

EXCLUDE option is supported with code coverage.

To exclude all functions in a namespace use the wildcard character:

MyNamespace::*

Have you tried /EXCLUDE:std::* ? It sounds as if that would be the way to go.

Ben Voigt
How exactly do I add this option to the build process? How do I control on how vsinstr is invoked?
brickner
Have you tried on the Analyze menu -> Configure Code Analysis (for Solution | for <projectname>)?
Ben Voigt
@Ben Voigt, code coverage settings can't be found in code analysis settings. Am I missing something?
brickner