string file = AppDomain.CurrentDomain.BaseDirectory + "ConsoleTest.exe";
Assembly assembly = Assembly.LoadFile(file);
//参数: 命名空间+类名
Type type = assembly.GetType("ConsoleTest.ChangeFileName");
object obj = assembly.CreateInstance(type.FullName);
//方法名
MethodInfo info = type.GetMethod("ChangeName");
//方法参数
string path = "E:\\temp\\";
object[] objs = new object[] { path };
try
{
//调用方法
info.Invoke(obj, objs);
}
catch (Exception ex)
{
Console.Write(ex.Message);
}