Search code examples
c++-clincover

NCover with a C++/CLI assembly


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"!?


Solution

  • 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.