Search code examples
unit-testingvisual-studio-2010c++-clicode-coveragetestrunconfig

Why don't I get code coverage results for C++/CLI project in Visual Studio 2010?


I've recently upgrade my solution to Visual Studio 2010.

I have 4 projects I want to cover using unit tests - 3 C# and 1 C++/CLI.

I get coverage for the C# projects but not for the C++/CLI project.

I did get for all of them in Visual Studio 2008.

I've configured the assemblies using testrunconfig -> Data and Diagnostics -> Code Coverage -> Configure.

Why don't I get code coverage result for the C++/CLI project?


Solution

  • I've found out what was wrong.

    It appears that the upgrade from Visual Studio 2008 to Visual Studio 2010 removed the profile option (/PROFILE).

    What was needed to be done was to go to

    Project Properties -> Configuration Properties -> Linker -> Advanced -> Profile

    and change this settings to Yes (/PROFILE).

    Now I get code coverage for the C++/CLI project.