This is for research purposes. I have .NET Framework 2.0 installed and I want to dynamically load mscorlib.dll 1.1 in order to execute its specific internal function.
When I wrote this code in C #:
static void Main(string[] args)
{
Assembly assem = Assembly.LoadFrom("C:\\mscorlib_my_private_1.1.dll");
System.Type type = assem.GetType("System.Console");
Type[] typeArray =new Type[1];
typeArray.SetValue(typeof(string),0);
System.Reflection.MethodInfo info = type.GetMethod("WriteLine", typeArray);
object[] param = new object[1];
param[0] = assem.FullName;
type.InvokeMember("WriteLine",
System.Reflection.BindingFlags.InvokeMethod, System.Type.DefaultBinder,
"", param);
}
Output: mscorlib, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089 "Not expected version 1.1 .
After a lot of googling, I know that mscorlib.dll is very special, but is it impossible?
source
share