添加装配体参考对话框
有没有办法在我自己的应用程序中使用 Visual Studio 的“添加程序集引用对话框”(或类似的东西)?我需要它来动态代码生成和编译。
这不仅仅是一个OpenFileDialog,因为它还查看GAC等,所以我认为我自己做起来会非常复杂。
如果不可能,我如何从 GAC 获取所有程序集的列表?
Is there a way to use visual studio's "add assembly reference dialog" (or something similar) in my own application? I need it for dynamic code generation and compilation.
This is not simply an OpenFileDialog, since it additionally looks into the GAC and so on, so it will be very complicated to do it on my own, I think.
If this is not possible, how can I get a list of all assemblies from the GAC?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有一个未记录的 API,它允许您从 GAC 枚举程序集。
There's an undocumented API which allows you to enumerate assemblies from the GAC.
从 GAC 获取所有程序集的最佳方法是使用 Fusion
第一种方法:以下代码片段显示如何实现您的目标:
第二种方法:GAC 目录 (% systemroot%\Assembly(默认安装)是一个像任何其他目录一样的标准目录,您应该能够循环该目录、加载程序集并检索程序集中所有类型的类型信息。
编辑:最简单方法的代码:
有关 Fusion.dll 的更多信息可以在以下位置找到:
http:// support.microsoft.com/kb/317540
请告诉我
如果您还有其他问题,
The best way to get all assemblies from the GAC is to use Fusion
first approch: The following code snippet shows how to achieve your goal:
second approach: The GAC directory (%systemroot%\assembly for default installations) is a standard directory like any other directory and you should be able to loop through the directory, load the assemblies and retrieve type information of all types within the assembly.
Edit: The code for the easiest way:
More information about Fusion.dll can be found at:
http://support.microsoft.com/kb/317540
Let me know if you have other questions
s
您不希望您的应用程序那么慢,对吧:P
源代码可用于 CR_QuickAddReference。
You dont want your app to be that slow, do you :P
Source is available for CR_QuickAddReference.