Search code examples
documentationc++-clidoxygendocumentation-generation

Documenting C++/CLI library code for use from c# - best tools and practices?


I'm working on a project where a c++/cli library is being used primarily from a c# application.

Is there any way to make the code comments in c++/cli visible to c# intellisence within visual studio?

Assuming there isn't, what would be the best way to document the c++/cli code to enable its easier use from c# (and within c++/cli of course)? What is you opinion on XML comments vs doxygen vs other tools (which)?


Solution

  • I have gotten it to work as follows:

    1. Use XML style comments for your C++/CLI header entries. This means the full XML comment is required (triple-slash comments, <summary> tag at a minimum)

    2. Make sure that the C++ compiler option Generate XML Documentation Files is on. This should generate an XML file with documentation with the same name as your assembly (MyDll.xml).

    3. Make sure that the C# project references your assembly MyDll.dll where MyDll.xml is also present in the same folder. When you mouse over a reference from the assembly, MS Visual Studio will load the documentation.

    This worked for me in Visual Studio 2008 on an assembly built for .NET 3.5.