这个问题是 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 文章:
- How to: Create Wrappers Manually (讨论如何手动创建互操作程序集。)
获得互操作程序集后,使用类似 Reflector 的工具反汇编它并生成原始 C# 源代码。 Reflector.FileDisassembler让这变得非常简单。
现在您可以将生成的 C#/VB 源代码直接包含到程序集中。
关于c# - 如何将 COM 互操作代理生成到 C# 源代码中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1058289/