Freigeben über


How to know the location of the assembly where it is being loaded from?

When there are multiple versions of the same assembly exist in the machine, it is very easy to get confused about where is the assembly being loaded in a reflection call. Here is a code snippet which can tell you where the the assembly coming from.

Console.WriteLine(typeof(ClassName).Assembly.Location);

Comments

  • Anonymous
    June 12, 2011
    If the assembly is in the GAC, I believe this could throw a security exception.

  • Anonymous
    April 08, 2012
    Maybe, at least when i was the administrator, this piece of code succeeded!