Is there a way to tell what exe is using which version of a .dll in the gac?

  • Thread starter Thread starter BR@dontmail
  • Start date Start date
I guess i should add, there are 5 versions of a .dll and i am not sure
what code is pointing at which version
 
Oh. ok , i was assuming there was a microsoft way to do this. Like
looking it up by the public token or by doing gacutil /resolve :) i
looked at the reflector just briefly , but am not sure this will
resolve it backwards to the exe that points to it.
 
I can think of two way to check which assemblies are loaded:

Either via visual stduio .net using the 'module' window when debugging the
application. The module window can be found at the menu Debug -> Windows ->
Modules

or

In code using reflection , something like this:

sing System;
using System.Reflection;

namespace ConsoleApplication1
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Assembly entryAssembly = Assembly.GetEntryAssembly();
AssemblyName[] assemblyNames = entryAssembly.GetReferencedAssemblies();
for(int i = 0; i < assemblyNames.Length; i++)
{
Console.WriteLine(assemblyNames.FullName);
}

Console.ReadLine();
}
}
}


HTH

Ollie Riches

IOn code using reflec
 
Okay, do you want to know what something references, or do you want to know
what something is referenced by? Also, do you want to know at runtime
through code or just run some tool at the command line?

There is no "backwards" in assemblies. For instance, if you have Foo.exe
which references Bar.dll, well, you can open Foo.exe with reflector and it
will tell you that Bar.dll is referenced. However, Bar.dll could also be
referenced by MyCoolProgram.exe. Do, as you can see, there can be no
relationship back from the assembly.
 
Back
Top