I’m trying to use Assembly.Load() to load an assembly that is in the GAC. For example, say I want to list out all of the types that exist in PresentationCore.dll, how would I go about loading PresentationCore.dll?
When I try this:
Assembly a = Assembly.Load("PresentationCore.dll");
I get a FileNotFoundException. Another answer on SO suggested I used Assembly.LoadFrom() to accomplish this – I’m hesitant to do that because Assembly.LoadFrom() is deprecated, according to Visual Studio 2008 – plus, it doesn’t seem to actually work.
Any ideas?
If the assembly is in the GAC you must load it via its fully qualified name.
For example, if I wanted to load
mscorlib.dllI would do something like this:The easiest way to determine an assembly’s fully qualified name is to load the assembly in Reflector and use the Name field from the lower display pane like this: