有没有办法通过CIL获取类间的类型并将其更改为public?

AssemblyDefinition x = AssemblyDefinition.ReadAssembly("x.dll");
TypeDefinition type = x.MainModule.GetType("Class");

最佳答案

AssemblyDefinition adef = AssemblyDefinition.ReadAssembly("x.dll");
TypeDefinition tdef = adef.MainModule.GetType("Class");
tdef.IsPublic = true;
adef.MainModule.Write("x_updated.dll");

10-04 14:19