记录c ++中使用的C ++ / CLI库代码 - 最佳工具和实践? [英] Documenting C++/CLI library code for use from c# - best tools and practices?

查看:193
本文介绍了记录c ++中使用的C ++ / CLI库代码 - 最佳工具和实践?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在开发一个项目,其中一个c ++ / cli库主要来自ac#应用程序。

有没有办法让代码注释c ++ / cli可视化视觉工作室内的c#intellisence?



假设没有,最好的方法是记录c ++ / cli代码以使其更容易使用从c#(当然还有c ++ / cli)?你对XML评论和doxygen与其他工具(哪个)有什么意见?

解决方案

我已经得到如下工作:


  1. 为C ++ / CLI标题条目使用XML样式注释。这意味着需要完整的XML注释(至少三重斜杠注释< summary> 标签)


  2. 确保C ++编译器选项生成XML文档文件是在。这应该生成一个带有与程序集相同名称的文档的XML文件(MyDll.xml)。


  3. 确保C#项目引用了您的程序集MyDll。 dll,其中MyDll.xml也存在于同一文件夹中。当您将鼠标悬停在装配体的引用上时,MS Visual Studio将加载文档。


这在Visual Studio 2008中为.NET 3.5构建的程序集上适用于我。


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)?

解决方案

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.

这篇关于记录c ++中使用的C ++ / CLI库代码 - 最佳工具和实践?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆