c# - 如何将 COM 互操作代理生成到 C# 源代码中?

标签 c# .net com interop

这个问题是 answer 对问题 Paul Alexander"Should interop assemblies be signed?" 的跟进。

Depending on how complex your Interop assemblies are - you can generate the proxy code into a separate .CS/.VB file and compile it directly into your assembly. Then you won't have to worry about strong name issues.

如何将 COM 库的互操作代理代码生成到 C# 源代码中?

我想这可以用 tlbimp 完成,然后用 Reflector 提取源代码。有没有人这样做过或者有更简单的方法吗?

最佳答案

请查看以下 MSDN 文章:

获得互操作程序集后,使用类似 Reflector 的工具反汇编它并生成原始 C# 源代码。 Reflector.FileDisassembler让这变得非常简单。

现在您可以将生成的 C#/VB 源代码直接包含到程序集中。

关于c# - 如何将 COM 互操作代理生成到 C# 源代码中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1058289/

相关文章:

Python Outlook 2007 COM 入门

c# - WebClient多线程响应

c# - 如何选择最合适的异常类型来抛出?

c# - 如何让媒体播放器使用 C# *播放*?

c# - 与在 C# 类终结器中执行操作相比,使用 IDisposable 的优势

c# - 在 .NET (VSTO) 中向电子表格添加按钮

c# - Tlbimp 无法生成互操作 Dll

c# - Cosmos DB - Mongo API - 文档不包含分片键

c# - SQLite 的 dotConnect 包不适用于 VS2013 中的 64 位 C# 项目?

c# - 将日期从 visual basic 转换为 c-sharp