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

# PostSharp

> PostSharp is the proven MSIL-based aspect-oriented framework, actively maintained since 2004. Metalama is the same team's open-source patterns & architecture toolkit for C#, built on Roslyn: source-level transformations, real-time feedback in the IDE, and an MIT-licensed core.

Canonical: https://postsharp.net/metalama/alternatives/postsharp.html

[PostSharp](https://postsharp.net/postsharp) is the proven MSIL-based aspect-oriented framework that PostSharp Technologies has built and supported since 2004. Metalama is the same team's open-source patterns & architecture toolkit for C#: the same idea of factoring out cross-cutting concerns, built on Roslyn instead of MSIL rewriting. Both products are actively maintained, supported, and updated for each new .NET release; the difference is _how_ they transform your code and what that buys you.

## MSIL rewriting versus Roslyn

PostSharp works by [rewriting the compiled MSIL](https://postsharp.net/metalama/alternatives/msil-rewriting): it runs after the C# compiler and modifies the binary assembly. The transformation happens below the source level: aspects are applied at build time, you debug your original source, and inspecting the woven code takes a decompiler.

Metalama works at the source level, as a Roslyn source generator. The result is ordinary C# that the compiler, debugger, and IDE all understand, which is what makes its design-time experience possible:

* **You can read and step into the generated code**, because it is C#, not IL.
* **You get real-time feedback in the IDE** (CodeLens, a source ↔ transformed [diff](https://postsharp.net/metalama/features/design-time-feedback), and diagnostics as you type), rather than waiting for a post-build weaving step.
* **Hand-written code can reference generated declarations**, because they exist as Roslyn symbols during compilation.
* **The core is open source** (MIT), where PostSharp is commercial.

## Which one to choose

- **For new projects on the current .NET stack, start with Metalama.** It is in active development and gives you the source-level, design-time, open-core experience above.
- **Existing PostSharp codebases need no migration.** PostSharp is actively maintained and [updated for each new version](https://postsharp.net/support/policies/versions) of .NET, C#, and Visual Studio. A few of its capabilities are not yet in Metalama, and Metalama is a redesign on Roslyn rather than a drop-in binary-compatible port.

Either way, you are working with the same team, the same support channels, and the same long-term commitment to .NET developer tools.

---

## Site navigation

- Next: [Fody](fody.md)
- Index of the whole site: [llms.txt](../../llms.txt)

