Skip to content
@metalama

Metalama

A Roslyn-based meta-programming framework for code generation, aspect-oriented programming, and architecture verification in large C# codebases.

Metalama logo

Metalama is a Roslyn-based meta-programming framework for code generation, architecture validation, and aspect-oriented programming in C#.

It lets you write cleaner, more maintainable .NET code by automating repetitive patterns at compile time using aspects, templates, and compile-time logic. It integrates tightly with the Roslyn compiler, providing full control over how your code is built.

Why Metalama?

  • Write and maintain less code: Eliminate boilerplate by generating it dynamically during compilation, reducing code lines and bugs by up to 15%.
  • Validate your codebase in real time: Enforce adherence to design rules and conventions without waiting for code reviews.
  • Excel with large, complex, or legacy codebases: Metalama shines at scale and does not require architectural changes.

When to use it?

Metalama is ideal for:

  • Large projects: Automate repetitive patterns across dozens of entities and hundreds of properties or methods.
  • Large teams: Align developers on consistent patterns and practices.
  • Long lifecycle projects: Maintain quality over years of development.

It's main use cases are:

License

Metalama is released under the MIT license.

Some optional extensions and IDE tooling are released under a proprietary license. 💎

Features

Resources

Quick Start

  1. Add the Metalama.Framework package to your project:

    dotnet add package Metalama.Framework
  2. Optionally, install Metalama Tools for Visual Studio Extension. It's free for individuals, non-commercial uses, and companies with up to 3 users.

  3. Explore the Metalama Marketplace for ready-made aspects or examples.

  4. Follow the Getting Started guide to create your first aspect.

Contributing

We welcome contributions! Here's how you can help:

For more details, see Contributing to Metalama.

Support & Community

Packages

Below is a list of packages published by Metalama:

Package Name Description
Metalama.Framework This is the public API of the Metalama Framework. It incorporates a reference to Metalama.Compiler, effectively replacing the Roslyn compiler with our custom version.
Metalama.Testing.UnitTesting Provides base classes and utilities for unit testing compile-time code.
Metalama.Testing.AspectTesting A framework based on xUnit for testing code generation by aspects.
Metalama.Framework.Redist Similar to Metalama.Framework, but excludes the dependency on Metalama.Compiler.
Metalama.Framework.Sdk Facilitates the use of the Roslyn API from aspects.
Metalama.Framework.Engine This is the core implementation of Metalama.Framework. Direct referencing of this package is discouraged and unsupported. It's intended to be a dependency for Metalama.Testing.AspectTesting.
Metalama.Framework.CompileTimeContracts Defines the public API between compiled T# templates and Metalama.Framework.Engine.
Metalama.Framework.Introspection Provides an API to inspect the object model that represents the compilation process of Metalama.Framework, such as aspect and advice instances, as well as its results.
Metalama.Framework.Workspaces A supplementary API to Metalama.Framework.Introspection, designed to facilitate the loading of Visual Studio projects and solutions. This package is also useful to inspect projects that don't use Metalama. It is used by Metalama.LinqPad.
Metalama.Tool The metalama tool for the .NET CLI.
Metalama.Extensions.DependencyInjection A framework that allows aspects to consume dependencies from an arbitrary dependency injection framework.
Metalama.Extensions.Metrics Implements code metrics that can be consumed by aspects and fabrics.
Metalama.Extensions.Multicast Simulates the legacy PostSharp attribute multicasting to ease the migration from PostSharp to Metalama.
Metalama.Extensions.Architecture Allows you to validate the source code against architecture rules.
Metalama.Patterns.Caching Comprehensive caching framework for Metalama.
Metalama.Patterns.Caching.Aspects Aspects designed for Metalama caching, building upon Metalama.Patterns.Caching.
Metalama.Patterns.Caching.Backend Provides an abstraction over caching backends, including an in-memory caching implementation.
Metalama.Patterns.Contracts Code contract aspects like [NotNull], [Url] for contract-based programming.
Metalama.Patterns.Immutability Represents the concept of Immutable Type so that it can be used by other packages like Metalama.Patterns.Observability.
Metalama.Patterns.Memoization Implements a memoization aspect, i.e. simple and super-fast caching.
Metalama.Patterns.Observability A Metalama aspect implementing INotifyPropertyChanged.
Metalama.Patterns.Wpf Aspects that implement WPF dependency properties and commands.
Metalama.LinqPad Provides integration with LINQPad for inspecting projects and solutions.
Flashtrace A structured tracing library used by Metalama.Patterns.Caching.
Flashtrace.Formatters Object formatters used in caching and logging.

Repositories

Repository License Description
Metalama MIT Our main repository containing the full open-source product.
Metalama.Compiler MIT A Roslyn fork for source code transformations.
PostSharp.Engineering MIT A custom multi-repo build and CI framework.
Metalama.Community MIT Community-contributed aspects repository.
Metalama.Documentation MIT Source for documentation hosted on Metalama Docs.
Metalama.Samples MIT Illustrative samples available at Metalama Examples.
Metalama.Premium 🔑 Proprietary Extensions available to customers with a commercial license.

Pinned Loading

  1. Metalama Public

    A modern open-source meta-programming framework for code generation, aspect-oriented programming, and architecture verification in large C# codebases.

    C# 188 6

  2. Metalama.Compiler Public

    Forked from dotnet/roslyn

    A fork of Roslyn that adds an extension point that allows for arbitrary code modifications.

    C# 31 1

  3. Metalama.Samples Public

    A set of samples for Metalama aspect framework.

    C# 21 7

  4. Metalama.Documentation Public

    Documentation of Metalama aspect framework. Available online at https://doc.metalama.net/.

    C# 1

Repositories

Showing 7 of 7 repositories
  • .github Public

    The GitHub organization profile.

    0 MIT 0 0 0 Updated Apr 11, 2025
  • Metalama.Samples Public

    A set of samples for Metalama aspect framework.

    C# 21 7 0 1 Updated Apr 10, 2025
  • Metalama Public

    A modern open-source meta-programming framework for code generation, aspect-oriented programming, and architecture verification in large C# codebases.

    C# 188 6 16 1 Updated Apr 10, 2025
  • Metalama.Documentation Public

    Documentation of Metalama aspect framework. Available online at https://doc.metalama.net/.

    C# 1 0 2 0 Updated Apr 9, 2025
  • Metalama.Compiler Public Forked from dotnet/roslyn

    A fork of Roslyn that adds an extension point that allows for arbitrary code modifications.

    C# 31 MIT 4,279 0 0 Updated Apr 9, 2025
  • website Public

    Source code of the https://metalama.net/marketplace website.

    SCSS 0 1 0 0 Updated Apr 9, 2025
  • C# 0 0 0 0 Updated Apr 4, 2025

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…