Modify metadata programmatically (.net executable)

I want my application to be able to modify the metadata of the .net executable. Net class for this, or do I need to parse the executable? (Can Roslyn provide any help here?)

If I need to parse an exe - What is its format? I searched but only came up with this entry on Wikipedia .

+3


source to share


2 answers


If I need to parse an exe - What is its format?



The format is specified in ECMA 335 , which describes Common Language Infrastructure . But that's over 400 pages, you don't want to create the reader / writer yourself. If you do, you should start with the section describing the header of the file (ยงII.25) .

+1


source


There are no .NET classes that allow you to rewrite IL.

You will need to select Mono.Cecil or read the CLR via C # and then write your own IL script. (This is technically possible since JB Evain wrote Mono.Cecil almost entirely himself.)



The Mono.Cecil source is available in full on Github .

The basics of using Mono.Cecil can be found on his wiki .

+2


source







All Articles