如何列出所有加载的程序集? [英] How do I list all loaded assemblies?

查看:37
本文介绍了如何列出所有加载的程序集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 .Net 中,我想枚举所有 AppDomains 上的所有加载的程序集.为我的程序的 AppDomain 执行此操作非常简单 AppDomain.CurrentDomain.GetAssemblies().我是否需要以某种方式访问​​每个 AppDomain?或者已经有一个工具可以做到这一点?

In .Net, I would like to enumerate all loaded assemblies over all AppDomains. Doing it for my program's AppDomain is easy enough AppDomain.CurrentDomain.GetAssemblies(). Do I need to somehow access every AppDomain? Or is there already a tool that does this?

推荐答案

使用 Visual Studio

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

这提供了有关每个程序集、应用程序域的详细信息,并提供了一些加载符号的选项(即包含调试信息的 pdb 文件).

This gives details about each assembly, app domain and has a few options to load symbols (i.e. pdb files that contain debug information).

使用进程浏览器

如果您需要外部工具,可以使用 Process Explorer(免费软件,由微软发布)

If you want an external tool you can use the Process Explorer (freeware, published by 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.

以编程方式

检查 this SO 问题,解释了如何做

Check this SO question that explains how to do it.

这篇关于如何列出所有加载的程序集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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