[英]How do I list all loaded assemblies?
In.Net, I would like to enumerate all loaded assemblies over all AppDomains.在.Net 中,我想枚举所有 AppDomains 上的所有加载程序集。 Doing it for my program's AppDomain is easy enough AppDomain.CurrentDomain.GetAssemblies()
.为我的程序的 AppDomain 做这件事很容易AppDomain.CurrentDomain.GetAssemblies()
。 Do I need to somehow access every AppDomain?我是否需要以某种方式访问每个 AppDomain? Or is there already a tool that does this?或者是否已经有一个工具可以做到这一点?
Using Visual Studio 使用Visual Studio
This gives details about each assembly, app domain and has a few options to load symbols (ie pdb files that contain debug information). 这提供了有关每个程序集,应用程序域的详细信息,并提供了一些加载符号的选项(即包含调试信息的pdb文件)。
Using Process Explorer 使用Process Explorer
If you want an external tool you can use the Process Explorer (freeware, published by Microsoft) 如果您需要外部工具,可以使用Process Explorer (免费软件,由Microsoft发布)
Click on a process and it will show a list with all the assemblies used. 单击一个进程,它将显示包含所有使用的程序集的列表。 The tool is pretty good as it shows other information such as file handles etc. 该工具非常好,因为它显示了其他信息,如文件句柄等。
Programmatically 编程
Check this SO question that explains how to do it. 检查这个解决如何操作的问题。
Here's what I ended up with. 这就是我最终的结果。 It's a listing of all properties and methods, and I listed all parameters for each method. 它是所有属性和方法的列表,我列出了每种方法的所有参数。 I didn't succeed on getting all of the values. 我没有成功获得所有的价值观。
foreach(System.Reflection.AssemblyName an in System.Reflection.Assembly.GetExecutingAssembly().GetReferencedAssemblies()){
System.Reflection.Assembly asm = System.Reflection.Assembly.Load(an.ToString());
foreach(Type type in asm.GetTypes()){
//PROPERTIES
foreach (System.Reflection.PropertyInfo property in type.GetProperties()){
if (property.CanRead){
Response.Write("<br>" + an.ToString() + "." + type.ToString() + "." + property.Name);
}
}
//METHODS
var methods = type.GetMethods();
foreach (System.Reflection.MethodInfo method in methods){
Response.Write("<br><b>" + an.ToString() + "." + type.ToString() + "." + method.Name + "</b>");
foreach (System.Reflection.ParameterInfo param in method.GetParameters())
{
Response.Write("<br><i>Param=" + param.Name.ToString());
Response.Write("<br> Type=" + param.ParameterType.ToString());
Response.Write("<br> Position=" + param.Position.ToString());
Response.Write("<br> Optional=" + param.IsOptional.ToString() + "</i>");
}
}
}
}
Using the command prompt cmd.exe
you just have to type使用命令提示符cmd.exe
,您只需键入
tasklist /M
in the console and it will list down all the process with all the dll
loaded by process.在控制台中,它将列出所有进程以及进程加载的所有dll
。 If that things went too fast in the console you can copy it to clipboard as如果控制台中的事情进行得太快,您可以将其复制到剪贴板
tasklist /M |clip
and paste it to notepad.并将其粘贴到记事本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.