如何生成COM互操作代理到C#源$ C ​​$ C? [英] How do I generate COM interop proxies into C# source code?

查看:150
本文介绍了如何生成COM互操作代理到C#源$ C ​​$ C?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题上的<一个跟进href="http://stackoverflow.com/questions/796945/should-interop-assemblies-be-signed/796980#796980">answer通过保罗·亚历山大以问题的应该互操作程序集签名?

This questions is a follow up on an answer by Paul Alexander to the question "Should interop assemblies be signed?".

根据多么复杂的互操作组件是 - 你可以生成代理code到一个单独的.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.

我怎么会去生成的互操作代理$ C $下一个COM库为C#源$ C ​​$ C?

How would I go about generating the interop proxy code for a COM library into C# source code?

我想这可能与TLBIMP,然后用与反射源来完成。有没有人这样做还是有一个更简单的方法?

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.)

一旦你拿到了互操作程序集,使用类似反射的一个工具,拆开它,并生成原始的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#源$ C ​​$ C?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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