[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

Dynamically loading assemblies

hcurrie

8/14/2008 3:05:00 PM

VS2008 Windows Forms
I am looking into dynamically loading assemblies, and possibly storing the
assembly code somewhere other than a .dll file (e.g. in a database).
I can easily get the contents of the DLL into a byte array, and I can then
use Assembly.Load to load the aasembly. I can then create objects using
CreateInstance. So far, so good.
However I have a problem with some DLLs that reference other DLLs.
DLL1 references DLL2, so I use Assembly.Load to load DLL2 and then again to
load DLL1.
This all seems to work without errors. I can use CreateInstance to create an
object from DLL1, and this seems to work too. However, if I delete the
original dlls, as soon as I try to call a method on this object, I get a
FileNotFoundException trying to load DLL2. It seems to be trying to load
DLL2 from the dll file. Why is it doing this when I have already loaded the
DLL? How do I get it to use the assembly that I have already loaded?
Any suggestions appreciated.
Thanks
Phil.


2 Answers

brushoff

7/26/2008 3:28:00 AM

0

On Jul 25, 9:19 pm, "Al. E. Crocodile" <ObamaCroc08.net> wrote:
> I wonder how much they pay the guy who pulls the switch, or the hanging
> lever ?
>
> Hell, I'd pay them to let me do it, spit on them before they go"JamesFenimore" <slipuva...@yahoo.com> wrote in message
>
> news:fbb68560-002c-4f03-81b3-3912c9219aba@m3g2000hsc.googlegroups.com...
>
>
>
> > It would certainly be FUNNY if all the Bushies guilty of crimes
> > against humanity were indicted by a U.N. war crimes tribunal during
> > Obama's presidency.
>
> > We're conservatively looking at Bush, Cheney, Rumsfeld, Rice, Feith,
> > Franks, Gonzales, Bremer, Powell, Wolfowitz, Rove, Addington, Yoo, and
> > of course, many U.S. contractor personnel assigned in Iraq.- Hide quoted text -
>
> - Show quoted text -

For oil richness, ask bushtards.

hcurrie

8/14/2008 4:15:00 PM

0

Found it.
I just need to handle the AppDomain.AssemblyResolve event, and load the
dependent dll assemblies in there.