How to load a DLL from GAC?

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.
 
S

Sreejumon[MVP]

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
 
K

Karun Karunakaran

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.
 
A

Alan Shi [MSFT]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top