Given a class library DLL that can be installed on the GAC (production) or not (development), I need to know whether the executing assembly is running from the GAC or not. How can I know this?
+7
A:
Did you try checking the Assembly.GlobalAssemblyCache
property?
bool loadedFromGac = this.GetType().Assembly.GlobalAssemblyCache;
...or:
bool loadedFromGac = Assembly.GetExecutingAssembly().GlobalAssemblyCache;
Fredrik Mörk
2009-07-17 14:14:02
+2
A:
Use the AssembyInfo class to find out the loaded assemblies for your app. The returned Assembly objects have a property called GlobalAssemblyCache which indicates what you need.
Robert Massa
2009-07-17 14:14:54