[MonoDevelop] Trying to Load assemblyes "on-the-fly"

Paulo Aboim Pinto esqueleto@tusofona.com
Thu, 29 Apr 2004 00:37:47 +0000


Hello

i'm trying to make a program that should load some DLL "on-the-fly" like 
plugins.

I'm having the problem with, where to put the DLLs do Load. I've try in 
the root directory of the program, or even in the same directory of the 
EXE, i also try the plugin directory and i get the same error:

esqueleto@hercules Debug $ ll
total 12K
-rwxr-xr-x    1 esqueleto wheel        4,0K Abr 29 00:10 DLLImport.dll
-rwxr-xr-x    1 esqueleto wheel        4,5K Abr 29 00:31 LoadDLL.exe
esqueleto@hercules Debug $ mono LoadDLL.exe
                                                                                

Unhandled Exception: System.IO.FileNotFoundException: File 
'DLLImport.dll' not found.
in (unmanaged) /usr/lib/libmono.so.0(mono_raise_exception+0x1f) [0x400a60bf]
in (unmanaged) /usr/lib/libmono.so.0 [0x400cd998]
in <0x0006c> (wrapper remoting-invoke-with-check) 
System.AppDomain:LoadAssembly (string,System.Security.Policy.Evidence)
in <0x0006b> System.AppDomain:Load (string)
in <0x00058> (wrapper remoting-invoke-with-check) System.AppDomain:Load 
(string)in <0x0001d> System.Reflection.Assembly:Load (string)
in <0x0002b> MainClass:Main (string[])
                                                                                

esqueleto@hercules Debug $


As you can see, i have the DLL in the same directory of the EXE, and i 
get the error that the DLL is not there .. :(

this is the code that i'm using           
            Assembly a = Assembly.Load("DLLImport.dll");
            Type[] types = a.GetTypes(  );
            foreach(Type t in types)
            {
                    Console.WriteLine("Type is {0}", t);
            }
            Console.WriteLine(
               "{0} types found", types.Length);

The DLL that i'm trying to import is a test one, with and method that 
return one number.
Anyone can help me ????


(())
Paulo Aboim Pinto
From: Portugal