How to locate an loaded assembly?

I simply want to know how to resolve if an certain assembly (some *.dll file) is loaded (used) by other .Net application.

Answer this question

How to locate an loaded assembly?

  • Karokpa

    There is an excellent and very interesting article at http://msdn.microsoft.com/msdnmag/issues/04/10/NETProcessBrowser/ that explains what you seem to be looking for.

    It has source code to browse managed processes and their loaded assemblies.

     If you just want to see if a dll is loaded (managed and unmanaged processes) the Process and ProcessModule will give you that info.

    Process[] arrProcesses = Process.GetProcesses();
    foreach (Process proc in arrProcesses)
    {
       Debug.WriteLine(proc.ProcessName);
      
    try
      
    {
          foreach (ProcessModule procmod in proc.Modules)
          {
             Debug.WriteLine(String.Concat("\t", procmod.FileName));
          }
       }
      
    catch
       {
       }
    }



  • Noel Rice

    Yes, i know but if i need to determine if an assembly is loaded by any another application...
  • Hephie

    AppDomain.CurrentDomain.GetAssemblies() gives you the list of all assemblies loaded in the current app domain.

    Michael Taylor - 2/7/06


  • How to locate an loaded assembly?