问题描述
我正在寻找一种读取应用程序使用的所有程序集(.dll)的方法。
在一个标准的C#项目中,有一个参考文件夹,展开后,我可以读取所有使用的库。
我的目标是以编程方式读取解决方案中每个项目使用的所有程序集。
最后,我是d想看看我已编译的* .exe应用程序使用了哪些库。
您是否看过?
请注意,您不使用的任何引用都不会最终发送到元数据中,因此在执行时不会看到它们。 / p>
我以前递归地使用了 GetReferencedAssemblies
来查找命名类型,而不必指定程序集。
I'm looking the way to read all assemblies (.dlls) used by my app.
In a standard C# project there is "References" folder, when it is expanded I can read all libraries used.
My goal is programatically read all assemblies which are used by each project in my solution.
Finally I'd like to see what libraries are used by my compiled *.exe application.
Have you looked at Assembly.GetReferencedAssemblies
?
Note that any references you don't use won't end up being emitted into the metadata, so you won't see them at execution time.
I've used GetReferencedAssemblies
recursively before now to find a named type without having to specify the assembly.
这篇关于如何获取应用程序使用的DLL的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!