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

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

问题描述

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



有任何方法使代码注释c ++ / cli在visual studio中可见的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 ++ / CLI库代码以便从c# - 最佳工具和实践中使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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