using System; using System.Reflection; using System.Runtime.Remoting; class App { static void Main() { try { object obj = UseAppDomain( "lib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3bf941bb1f722efe"); InvokeObject(obj); } catch(Exception e1) { Console.WriteLine(e1.Message); } } static object UseAppDomain(string name) { AppDomain ad = AppDomain.CurrentDomain; return ad.CreateInstanceAndUnwrap(name, "LibraryCode"); } static void InvokeObject(object obj) { Type type = obj.GetType(); MethodInfo mi = type.GetMethod("GetVersion"); string version = (string)mi.Invoke(obj, null); Console.WriteLine(version); } }