Reputation: 27633
I want my application to be able to modify the metadata of a .net executable. Is there a .net class to do that, or do I have to parse the executable? (Can Roslyn be of any help here?)
If I need to parse the exe - What is its format? I searched, but only came up with this Wikipedia entry.
Upvotes: 3
Views: 685
Reputation: 244757
If I need to parse the exe - What is its format?
The format is specified in ECMA 335, which describes the Common Language Infrastructure. But it's over 400 pages, you don't want to implement a reader/writer for all of that yourself. If you really do, you should probably start with the section that describes the file header (§II.25).
Upvotes: 1
Reputation: 9426
There are no .NET classes that allow you to rewrite IL.
You'll have to choose between using Mono.Cecil or reading CLR via C# and then writing your own IL rewriter. (It's technically possible, after all JB Evain wrote Mono.Cecil almost entirely by himself).
Mono.Cecil's source is available in full on Github.
Basics on Mono.Cecil's usage maybe found in its wiki.
Upvotes: 2