Changing internal class to public (CIL, Mono.Cecil)

757 views Asked by At

Is there a way to get interclass's type via CIL and change It to public?

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

There are 1 answers

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