Metalama.Framework
2026.1.21
Prefix Reserved
dotnet add package Metalama.Framework --version 2026.1.21
NuGet\Install-Package Metalama.Framework -Version 2026.1.21
<PackageReference Include="Metalama.Framework" Version="2026.1.21" />
<PackageVersion Include="Metalama.Framework" Version="2026.1.21" />
<PackageReference Include="Metalama.Framework" />
paket add Metalama.Framework --version 2026.1.21
#r "nuget: Metalama.Framework, 2026.1.21"
#:package Metalama.Framework@2026.1.21
#addin nuget:?package=Metalama.Framework&version=2026.1.21
#tool nuget:?package=Metalama.Framework&version=2026.1.21
An open-source patterns & architecture toolkit for C#.
Metalama lets you define your team's patterns once: the compiler writes the repetitive parts at build time and enforces your rules as you type.
Why Metalama?
- Write the pattern once, apply it everywhere: Aspects generate the repetitive code at compile time; the boilerplate never lands in the repo, so it never needs review or maintenance.
- Enforce architecture as you type: Dependency rules, naming conventions, and pattern guidelines in plain C#, with real-time IDE feedback long before the pull request.
- Stay consistent in the AI era: Hand-written or AI-generated, every line is checked against your rules; a pattern change is one file edit and the whole codebase follows at the next build.
Built on Roslyn by the PostSharp team, who have been doing compiler-level meta-programming in .NET since 2004.
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.
Its main use cases are:
- Design Patterns: Singleton, Memento, Factory, Builder, Decorator, Proxy, ...
- UI Patterns: INotifyPropertyChanged, Change Tracking, Memoization, Undo/Redo, Command, Dependency Properties, ...
- Object Services: Cloning, ToString, Comparison, ...
- Defensive Programming: Code Contracts (preconditions, post-conditions, invariants)
- DevOps: Logging & Tracing, Metrics, Caching, Exception Handling
License
Metalama is vendor-led open source: built and maintained by full-time engineers, funded by commercial licenses.
The core framework, which is the large majority of the codebase, is released under the MIT license. It cannot be taken away, relicensed, or paywalled.
Some optional extensions and IDE tooling are released under a proprietary license. 💎
Features
- Code Generation
- Code Validation
- Architecture Validation 💎
- Immediate Editor Feedback
- Code Fix Toolkit 💎
- Ready-to-Use Aspect Libraries
- Visual Studio Tooling 💎
- Test Frameworks
- Debugging of Transformed Code
- Roslyn Extensibility SDK
- Code Query API
Resources
- Metalama Website
- Documentation
- Annotated Examples
- Changelogs
- Release Notes
- Metalama Tools for Visual Studio Extension
Quick Start
Add the
Metalama.Frameworkpackage to your project:dotnet add package Metalama.FrameworkOptionally, install Metalama Tools for Visual Studio Extension. It's free for individuals, non-commercial uses, and companies with up to 3 users.
Explore the Metalama Marketplace for ready-made aspects or examples.
Follow the Getting Started guide to create your first aspect.
Building Metalama from Source
Please check instructions here.
Contributing
Contributions are accepted through the following channels:
- Share your aspects on the Metalama Marketplace.
- Contribute aspects to Metalama.Community.
- Improve the documentation. Learn how.
- Fix bugs or contribute code. Learn how.
For more details, see Contributing to Metalama.
Support
- Report issues on GitHub. Follow these recommendations.
- Ask questions and submit proposals in GitHub discussions.
- Enterprise support is available. Learn more about premium support. 💎
Related Packages
- Metalama.Extensions.DependencyInjection: allows you to inject services into your aspects using a dependency injection framework.
- Metalama.Extensions.Metrics: allows your aspects or fabrics to rely on code metrics, e.g. number of lines of code.
- Metalama.Extensions.Validation 💎: provides an API allowing to validate code and references, usages and dependencies.
- Metalama.Extensions.Architecture 💎: built on
Metalama.Extensions.Validation, implements concrete rules for architecture verification. - Metalama.Extensions.CodeFixes 💎: allows you to attach code fix suggestions to errors and warnings or to suggest code refactorings.
- Metalama.Patterns.*: a set of ready-made, professionally-built aspect libraries built with
Metalama.Framework, most of them open-source.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Metalama.Compiler (>= 2026.1.13)
- Metalama.Framework.Redist (>= 2026.1.21)
- Microsoft.CSharp (>= 4.7.0)
NuGet packages (30)
Showing the top 5 NuGet packages that depend on Metalama.Framework:
| Package | Downloads |
|---|---|
|
Metalama.Extensions.DependencyInjection
An official and open-source Metalama extension that allows aspects to consume dependencies from an arbitrary dependency injection framework. |
|
|
Metalama.Extensions.Multicast
An official and open-source Metalama extension that emulates PostSharp multicasting. |
|
|
Tofi.Framework.Aspects
Package Description |
|
|
Metalama.Patterns.Contracts
Contract-Based Programming (or Design-by-Contract) with custom attributes such as [NotNull] or [Url] thanks to Metalama: pre-conditions, post-conditions and invariants. |
|
|
Shinya.Core
Shinya.Framework |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.1.21 | 0 | 7/21/2026 |
| 2026.1.20 | 1,807 | 7/15/2026 |
| 2026.1.19 | 8,138 | 6/27/2026 |
| 2026.1.18 | 29,104 | 6/10/2026 |
| 2026.1.17 | 4,961 | 6/5/2026 |
| 2026.1.16 | 1,587 | 6/3/2026 |
| 2026.1.15-rc | 2,882 | 5/15/2026 |
| 2026.1.14-rc | 1,178 | 5/13/2026 |
| 2026.1.13-preview | 904 | 5/13/2026 |
| 2026.1.12-preview | 1,211 | 5/12/2026 |
| 2026.1.11-preview | 1,365 | 5/6/2026 |
| 2026.1.10-preview | 1,669 | 4/29/2026 |
| 2026.1.9-preview | 1,310 | 4/17/2026 |
| 2026.1.8-preview | 28,839 | 4/13/2026 |
| 2026.0.25 | 987 | 6/30/2026 |
| 2026.0.24 | 922 | 6/27/2026 |
| 2026.0.23 | 15,205 | 5/15/2026 |
| 2026.0.22 | 8,848 | 4/29/2026 |
| 2026.0.21 | 20,597 | 4/17/2026 |
| 2025.1.18 | 930 | 6/30/2026 |