[Home](../../) › [Metalama](../../metalama) › [Use Cases](../applications.md) › [Alternatives](../alternatives.md) › [Aspect-Oriented Programming](aspect-oriented-programming.md) › MSIL Rewriting

# MSIL Rewriting

> MSIL Rewriting modifies binary assemblies post-C# compilation. Tools like PostSharp, Mono.Cecil, Fody, AspectInjector, and Rougamo use this approach.

Canonical: https://postsharp.net/metalama/alternatives/msil-rewriting.html

_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](https://postsharp.net/postsharp) implements its own MSIL rewriting stack.
* [Mono.Cecil](https://github.com/jbevain/cecil) is a standalone library that can be used to modify .NET assemblies.
* [Fody](https://postsharp.net/metalama/alternatives/fody) is based on `Mono.Cecil`. It integrates with MSBuild and implements a plug-in system so that MSIL transformations can be packaged and combined.
* [AspectInjector](https://github.com/pamidur/aspect-injector) and [Rougamo](https://github.com/inversionhourglass/Rougamo) are AOP frameworks based on `Mono.Cecil`.

---

## Site navigation

- Next: [Middleware-based](middleware.md)
- Index of the whole site: [llms.txt](../../llms.txt)

