引用 COM DLL 时帮助文本丢失
我对 COM 几乎一无所知,但我会尽力使问题尽可能清楚。
我有一个 .NET 4.0 项目,并且正在引用用 VBScript 编写的较旧的 COM DLL。
当我在代码中使用此 DLL 时,我在 VS2010 中没有获得任何描述方法和类的自定义帮助文本。它们在对象浏览器中也不可用。
我想这与 .NET 应用到 COM 库的自动包装器有关。帮助文本似乎在这个过程中丢失了。
当我直接在VS的对象浏览器中查看dll时,我可以看到方法等的文本。
有没有办法保留描述文本以便使用引用的COM dll进行编码?
I barely have any knowledge of COM, but I will try to make the question as clear as possible.
I have a .NET 4.0 project and am referencing an older COM DLL written in VBScript.
When I use this DLL in the code, I don't get any custom helptexts in VS2010 describing the methods and classes. They are also not available in the object browser.
I guess this has something to do with the automatic wrapper that is applied by .NET to the COM library. The help texts seem to get lost in the process.
When I view the dll directly in the object browser of VS, I can see the texts for methods etc.
Is there a way to keep the describing texts for coding with the referenced COM dll?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您指的是可用于 .NET 类的内联帮助文档而不是参数类型信息吗?如果是这样,我会分享你的沮丧。为了让通过 COM 互操作使用我的 COM 对象的 C# 程序员受益,我花了很多精力在 IDL 中编写帮助字符串注释,结果发现它们都没有在类型库导入中幸存下来。
Adam Nathan 的书“.NET 和 COM:完整的互操作性指南”中的“常见问题解答:类型库导入程序为什么不自动将帮助字符串内容保存在 DescriptionAttribute 中?”下对此行为进行了解释。我发现这本书对于学习 COM 互操作非常有帮助,尽管它已经很老了。您还可以购买 Kindle、epub 和 pdf 格式的书籍。
Adam Nathan 的解释是帮助字符串属性未转换为 System.ComponentModel。 DescriptionAttribute 对象,因为 DescriptionAttributes 适用于 Windows 窗体控件并且不可本地化。
就我个人而言,我仍然希望帮助字符串属性能够被翻译。如果该功能尚未添加到上面链接的 codeplex 类型库导入器中,也许可以添加该功能。
Are you referring to the inline help documentation available for .NET classes rather than parameter type information? If so I share your frustration. I went to a lot of effort to write helpstring comments in my IDL for the benefit of C# programmers consuming my COM object via COM interop to find that none of them survived type library importing.
There is an explanation of this behaviour in Adam Nathan's book ".NET and COM: The Complete Interoperability Guide" under "FAQ: Why doesn't the type library importer save the helpstring contents in DescriptionAttribute automatically?". I've found this book very helpful for learning about COM interop, despite its age. It's also available to buy in Kindle, epub and pdf formats.
Adam Nathan's explanation is that helpstring attributes are not translated into System.ComponentModel.DescriptionAttribute objects because DescriptionAttributes are meant for Windows forms controls and are not localizable.
Peronally, I'd still prefer that helpstring attributes were translated anyway. Perhaps that feature could be added to the codeplex type library importer linked above if it doesn't do it already.