A shared passion
for clean code.

Metalama logo

A modern Roslyn-based meta-programming framework to improve your code quality and productivity in C#.

Metalama is the only C# code quality & productivity tool that lets you:

  • Reduce the amount of required code by eliminating boilerplate, generating it dynamically during compilation. That typically results in 15% fewer lines of code and bugs.
  • Verify code in real-time according to your own rules to enforce adherence to your architecture, patterns, and conventions. No need to wait for code reviews.
  • Provide coding assistance straight from the IDE to your team with bespoke code fixes and save time on hesitations, documentation lookups, and typing.

How does it

  • Add the Metalama.Framework package to your project.

  • Create an aspect class and write meta code that transforms the code using simple C#-based templates, report warnings or errors, or suggest code fixes. The aspect becomes the implementation of your patterns or architecture.

  • Tell your team to add the aspects to their code using custom attributes or add them in bulk compile-time C# code named fabrics.

  • You're done! When you run your app, it executes the code generated by your aspect but does not litter your source code. You now start seeing warnings and errors reported by the aspect. New generated methods are visible in Intellisense. Suggested refactorings are available in the lightbulb or screwdriver menu.


  • T# templates

    T# Templates: Leverage the power of T#, a markup-free, C# syntax-compatible template language with Visual Studio syntax highlighting.

  • Override anything

    Override Anything: Unlike proxy-based AOP frameworks, Metalama is not limited to interfaces and virtual methods.

  • Aspect inheritance

    Aspect Inheritance: Automatically apply aspects to child classes by marking parent classes — even across projects.

  • Fabrics

    Fabrics: Implement compile-time project entry points for aspect addition or code validation.

  • Intellisense

    Intellisense: Access aspect-introduced code in real-time, without recompiling.

  • Diagnostics

    Instant Diagnostics: Receive real-time error and warning notifications from aspects in the editor.

  • Diff Preview

    Diff Preview: Seamlessly compare source and transformed code within Visual Studio.

  • CodeLens integration

    CodeLens: Quickly identify applied aspects in the editor even when it is not obvious from the source code.

  • Code fixes

    Custom Fixes & Suggestions: Develop team-specific code fixes linked to diagnostics.

  • Syntax highlighting

    Syntax Highlighting: Easily distinguish meta code with T# color-coding.

  • Debugging

    Debugging Flexibility: Choose between stepping into transformed code or remaining in source code.

  • Testing framework

    Testing Framework: Efficiently test aspects on various target declarations. Integrates with the Visual Studio test runner.

  • LinqPad

    Querying Interactively: Use the Linqpad driver to query your codebase interactively like a database and analyze the behavior of your aspects and fabrics.

  • Divorce

    No Vendor Lock-In: Export transformed code and revert to vanilla C# anytime.

  • Roslyn extensibility

    Extensible with Roslyn: Overcome the limitations of Metalama and write transformations directly with Roslyn.

  • Open-source extensions

    Open-Source Extensions: Access a range of published extensions and samples under open-source licenses.

  • Multi-Platform: Harness the power of MSBuild and .NET Standard 2.0 across platforms.

  • Optimal Performance: Experience no run-time overhead with Metalama, as the code you see is the code executed.

  • Exceptional Documentation: Learn Metalama with our comprehensive reference documentation, commented examples, and an online sandbox. All examples are continuously tested for accuracy.

The result: consistently clean code.

Boosting Development Efficiency

Metalama streamlines software development, reducing code by 10-50% and allowing developers to focus on meaningful tasks. It enhances job satisfaction by eliminating repetitive low-level code and frustrating reviews and acts as a talent multiplier, empowering architects and senior developers to address architectural challenges. New team members can contribute effectively without burdening themselves with low-level technical details.

Taming Code Complexity

Separating technical details from business logic results in cleaner, more readable code, enabling team members to work efficiently. Adherence to initial architecture and design patterns minimizes complexity, ensuring a manageable, well-structured codebase. This approach prevents excessive rules and violations, whether unintentional or due to unwarranted creativity, maintaining overall simplicity and integrity.

Elevating Application Reliability

Aspects boost codebase readability and maintainability by separating technical and business logic. Meta-programming promotes consistency and streamlines reviews, reducing developer oversights and unwanted creativity. Aspects also improve software modularity, preventing duplication and enhancing reusability, adaptability, and efficiency.

Streamlining Maintenance

Metalama's ultimate advantage is reducing maintenance costs and prolonging codebase lifespan. With maintenance constituting 55%-95% of software system costs, low complexity is crucial for post-release team member productivity. As developers spend 70% of their time understanding code, maintaining simplicity greatly benefits the maintenance team's efficiency.

What is holding you back?

I can do the same with open-source tools.

You may think of Roslyn analyzers, Roslyn code generators, or open-source IL tools.

But Metalama plays in a different league.

Metalama is integrated. No other tool than Metalama allows you to both generate code that is visible at design time and override hand-written code. You would need to use a combination of open-source tools, which do not integrate with each other, to achieve what Metalama can do.

Metalama is much simpler. Doing meta-programming well at the abstraction of Roslyn or MSIL is very complex (think years of experience needed, not months). When done naively, low-level metaprogramming is comparable to hacking. It can significantly increase complexity, especially after the developer who implemented the meta-code leaves the team.

Metalama is engineered for good architecture. Metalama is designed to simplify development. It does not offer hacks that make the code less predictable or understandable. Software development has three cultures: hacking, science, and engineering. We belong to the last one while staying attentive to both others.

Metalama is a complete, well-though-out solutions. Alternatives focus on the most frequent use cases and cut corners – for instance, they don’t properly implement async methods. PostSharp goes the extra mile and adds enough extension points never to get stuck.

I will lose control over my code.

Delegating is what you actually want. You want the machine to care for low-level, repetitive details so you have more time to focus on meaningful tasks.

You are already used to that. People were already afraid of losing control over performance when the industry moved from assembly language to C, then to the managed, garbage-collected memory model of C# and Java. We’ve lost control over low-level details but gained huge productivity and reliability.

You are not completely losing control. PostSharp gives you a lot of mechanisms to override the default behaviors.

You can return to the source code anytime. There is no vendor lock-in.

I will no longer understand what the code is doing.

We believe you will understand your code much better than before.

Debug the transformed code. You may notice behavior you cannot understand solely by reading the source code. You can, at any time, configure Metalama to step into the transformed code instead of the source code, and you will see exactly what is happening.

Use the diff preview. You can compare the source code with the transformed code from Visual Studio without rebuilding the solution.

I am already using Resharper or Rider.

You can use both. We are also fans of Rider.

Metalama reduces the amount of code. Refactoring tools make developers write code faster but do not reduce the code necessary to implement a feature.

Metalama makes it easy to write custom rules and code fixes. Other refactoring tools have much more complex APIs.

How does it compare?

Metalama PostSharp Roslyn Plug-In Fody
Technology Roslyn MSIL Roslyn MSIL
Transforming the compilation using low-level APIs
Yes Yes No Yes
Adding behaviors to source code using simple custom aspects or templates.
Yes Yes No No
Introduce new members or interfaces and reference them in the source code.
Yes No Complex No
Analyze source code and report warnings and errors in real-time.
Yes Requires rebuild Complex Requires rebuild
Debug and export transformed code.
Yes No N/A No

Get started with Metalama.

More than 10% of all Fortune 500 companies have already chosen PostSharp.