How to load a DLL from GAC?

  • Thread starter Thread starter Karun Karunakaran
  • Start date Start date
K

Karun Karunakaran

Hi,
I have a strong named dll that is in the GAC. I am trying
to load it at runtime using Reflection.Assembly.Load. But
I get a FileNotFound exception, and the fusion log shows
that .NET is searching for the file only in the local bin
folder. I have tried both Load(String) and Load
(AssemblyName) versions - in the latter specifying the
Culture, Version and PublicKeyToken properties - but it
doesn't work. How do I force it to load from the GAC?

(There is no versioning problem, since the version has
been explicitly set to 1.0.0.0)

Thanks,
Karun.
 
Hi Karun,

You have to use fully qualified name as given below.

Assembly.Load("AssemblyName, Version=1.0.0.1, Culture=neutral,
PublicKeyToken=2323adedadad089");


--
Let me know if you need further help

Regards
Sreejumon[MVP]
www.mstechzone.com
 
Hi,

Another question regarding the Load method given below.
How is it that I can give Culture=neutral within a string
and get away with it, but specifying a
objAssemblyName.CultureInfo = New CultureInfo("Neutral")
gives a "Culture neutral not supported" error message?

Thanks,
Karun.
 
As long as all the fields are set, this should also work. Look at the Fusion
log to see whether or not all of the properties you set on AssemblyName
showed up in the actual reference the binder saw.

..\lan
 
Back
Top