tags:

views:

24

answers:

2

Does anybody know how to do coverage of an C++/CLI class using NCover?

NCover only measures coverage of an assembly if it finds a matching .pdb file.

However, my C++/CLI project does not output a .pdb file.

If I go to "Visual Studio -> Configuration Properties -> C/C++ -> Output Files -> Program Database File Name" and set it to "MyDll.pdb" it actually outputs a file called "MyDLL.idb"!?

+2  A: 

Yeah, confuzzling setting. It is actually a linker setting: Linker, Debugging, Generate Program Database File. Make sense if you think about it, only after linking are all object files combined and can debug info be created.

Not sure why you'd have to jump through this hoop, the default settings in the Debug configuration ensure that a .pdb file is created. Ought to be good enough for NCover, I'd imagine.

Hans Passant
Thank you, this helped. I had to turn on debug info in c++ and in linker settings. Then the pdb-File was created and NCover reported coverage correctly.
Stiefel
+1  A: 

Are you compiling a Release build, or Debug build? As Hans mentioned, the default settings for Debug will generate a .pdb that NCover can use.

Peter Waldschmidt