MSIL Rewriting

MSIL Rewriting is the process of modifying the binary assembly during the build process. An additional rewriting step is added to this process just after the C# compiler. These tools can add MSIL instructions, as well as new types and members, during the build.

The following tools are based on MSIL rewriting:

  • PostSharp implements its own MSIL rewriting stack.
  • Mono.Cecil is a standalone library that can be used to modify .NET assemblies.
  • Fody is based on Mono.Cecil. It integrates with MSBuild and implements a plug-in system so that MSIL transformations can be easily packaged and combined.
  • AspectInjector and Rougamo are AOP frameworks based on Mono.Cecil.