Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Thu, 14 Aug 2008 16:04:44 +0100,    group: microsoft.public.dotnet.framework        back       


Dynamically loading assemblies   
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.
date: Thu, 14 Aug 2008 16:04:44 +0100   author:   Phil N/A

Re: Dynamically loading assemblies   
Found it.
I just need to handle the AppDomain.AssemblyResolve event, and load the 
dependent dll assemblies in there.
date: Thu, 14 Aug 2008 17:14:51 +0100   author:   Phil N/A

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us