如何列出所有加载的程序集?

在.Net中,我想枚举所有AppDomain上的所有加载的程序集。 为我的程序的AppDomain做它很容易AppDomain.CurrentDomain.GetAssemblies() 。 我需要以某种方式访问​​每个AppDomain? 还是有一个工具,这样做?

使用Visual Studio

  1. 将debugging器附加到进程(例如,从debugging开始或debugging>附加到进程)
  2. 在debugging时,显示模块窗口(debugging> Windows>模块)

这给出了有关每个程序集,应用程序域的详细信息,并有几个选项来加载符号(即包含debugging信息的pdb文件)。

在这里输入图像说明

使用Process Explorer

如果你想要一个外部工具,你可以使用Process Explorer (免费软件,由微软公司发布)

点击一个进程,它将显示所有使用的程序集列表。 该工具是相当不错的,因为它显示其他信息,如文件句柄等

编程

检查这个问题,解释如何做到这一点。

这是我最后的结果。 这是所有属性和方法的列表,我列出了每个方法的所有参数。 我没有成功获得所有的价值。

 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>"); } } } }