Loading an assembly
-
I have a windows application called X, I build it, and evidently I can run the executable X.exe. But now, I build this application to a X.dll; and I want to load that X.dll from another application YYY.EXE, and start the X-application. I tried in Y: Assembly assemblyX = Assembly.Load("X"); // works Type typeX = assemblyX.GetType("namespace + classname"); // works MethodInfo methodinfoCOnstructor = typePlannet.GetMethod("?"); // ? How can I start application X? Thanks!
-
I have a windows application called X, I build it, and evidently I can run the executable X.exe. But now, I build this application to a X.dll; and I want to load that X.dll from another application YYY.EXE, and start the X-application. I tried in Y: Assembly assemblyX = Assembly.Load("X"); // works Type typeX = assemblyX.GetType("namespace + classname"); // works MethodInfo methodinfoCOnstructor = typePlannet.GetMethod("?"); // ? How can I start application X? Thanks!
I just found it myself: Assembly assPlannet = Assembly.Load("Plannet"); Type typePlannet = assPlannet.GetType("Conseur.Plannet.PlannetClient"); MethodInfo methodinfoMain = typePlannet.GetMethod("Main"); Object obj = Activator.CreateInstance(typePlannet); Object[] args = new Object[1]; methodinfoMain.Invoke(obj, null);