Here it is:
// try to run the program
if (m_Files.ContainsKey(APPLICATION_ASSEMBLY))
{
// get the file and load it
Assembly a = Assembly.Load(m_Files[APPLICATION_ASSEMBLY]);
// find the entry point of the file (Main)
MethodInfo mi = a.EntryPoint;
if (mi != null)
{
// create an istance of the Startup form Main method
object o = a.CreateInstance(mi.Name);
// handle the Resolve assembly event so we can handle known
assemblies
AppDomain.CurrentDomain.AssemblyResolve += new
ResolveEventHandler(CurrentDomain_AssemblyResolve) ;
// invoke the application starting point
mi.Invoke(o, null);
}
}
private static Assembly CurrentDomain_AssemblyResolve(object sender,
ResolveEventArgs args)
{
string AssemblyName = args.Name.Substring(0, args.Name.IndexOf(','));
if (m_Files.ContainsKey(AssemblyName))
{
// Load the requested assembly from our files
Assembly a = Assembly.Load(m_Files[AssemblyName]);
return a;
}
else return null; // unknown assembly (often in the GAC)
}
I hope it helps
"IfThenElse" <sq**********@hotmail.comwrote in message
news:u0**************@TK2MSFTNGP05.phx.gbl...
Hi ThunderMusic,
Can you please supply a sample code so I can learn how to do what you did?
Thanks a mill
"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:OX**************@TK2MSFTNGP03.phx.gbl...
>>I made it... not by loading a module tought... I handle the
AssemblyResolve event of the AppDomain and load the appropriate assembly
when needed.
Thanks to all..
ThunderMusic
"Colby Africa" <co**********@gmail.comwrote in message
news:11*********************@v3g2000hsg.googlegro ups.com...
>>The name will include the namespace + the type name (so, something
like ThunderMusic.Projects.DLL.MyDll).
Does that make sense?