在Visual Studio 2010 Express中自动从dll生成C#包装类? [英] Automatically generate C# wrapper class from dll in Visual Studio 2010 Express?

查看:180
本文介绍了在Visual Studio 2010 Express中自动从dll生成C#包装类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的同事告诉我,Visual Studio允许一个指向一个 .dll 并自动生成一个C#包装类。这真的有可能吗?如果是这样,那么如何才能实现呢?我已经浏览过网络,但没有提出任何事情!



感谢所有!






我想分享这些资源,




解决方案

3例:


  1. 该DLL表示一个托管程序集=>您直接在项目中引用它,并使用它

  2. 该DLL表示COM对象=>您可以使用 tlbimp.exe 实用程序生成一个托管的包装器

  3. 该DLL代表一个非托管库,其中有一些导出ed功能。那是最艰难的一个没有工具。您将不得不查阅库的文档以了解导出的函数名称和参数,并构建管理的P / Invoke包装器。您可以使用 dumpbin.exe 实用程序查看已导出函数的列表。以下是有关不同步骤的MSDN上的文章


I was told by a colleague of mine that Visual Studio allows one to point to a .dll and auto-magically generate a C# wrapper class. Is this really possible? And if so, how does one go about achieving this? I've browsed the web, but have failed to come up with anything!

Thanks all!


Figured I'd share these resources as well,

解决方案

3 cases:

  1. The DLL represents a managed assembly => you directly reference it in your project and use it
  2. The DLL represents a COM object => you could use the tlbimp.exe utility to generate a managed wrapper
  3. The DLL represents an unmanaged library with some exported functions. That's the toughest one. There are no tools. You will have to consult the documentation of the library to know the exported function names and parameters and build managed P/Invoke wrappers. You could use the dumpbin.exe utility to see a list of exported functions. Here's an article on MSDN about the different steps.

这篇关于在Visual Studio 2010 Express中自动从dll生成C#包装类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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