如何生成COM互操作代理到C#源代码

如何生成COM互操作代理到C#源代码

本文介绍了如何生成COM互操作代理到C#源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 这个问题是关于回答由 Paul Alexander 问题This questions is a follow up on an answer by Paul Alexander to the question "Should interop assemblies be signed?". 取决于Interop程序集的复杂程度是 - 您可以生成代理代码到一个单独的.CS / .VB文件,并将其直接编译到您的程序集。那么你不必担心强名称问题。 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库的interop代理代码进入C#源代码?How would I go about generating the interop proxy code for a COM library into C# source code?我想可以用tlbimp完成,然后用Reflector提取源代码。有没有人做这个或有一个更简单的方法?I guess it could be done with tlbimp and then extracting the source with Reflector. Has anyone done this or is there a simpler way?推荐答案看看下面的MSDN文章:Take a look at the following MSDN article: 如何手动创建包装器(讲述如何手动创建互操作程序集。)How to: Create Wrappers Manually (Talks about how to create your interop assembly manually.)互操作程序集,请使用 Reflector 工具反汇编并生成原始C#源代码。 Reflector.FileDisassembler 使这非常容易。Once you've got the interop assembly, use a tool like Reflector to disassemble it and generate the raw C# source. Reflector.FileDisassembler makes this really easy.现在,您可以将生成的C#/ VB源直接包含到程序集中。Now you can include the generated C#/VB sources directly into your assembly. 这篇关于如何生成COM互操作代理到C#源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-15 09:46