Metalama + PostSharp - Visual Studio Marketplace Skip to content
| Marketplace
Sign in
Visual Studio>Tools>Metalama + PostSharp
Metalama + PostSharp

Metalama + PostSharp

PostSharp Technologies

postsharp.net
|
530,078 installs
| (589) | Free
A unified UI for Metalama and PostSharp, two code generation and validation toolkits for .NET. They help you deliver clean code, without boilerplate, strictly adhering to architecture.
Download

Metalama and PostSharp for Visual Studio

This extension provides a unified UI for Metalama and PostSharp, the two compiler-level toolkits from PostSharp Technologies.

Both toolkits let you define a pattern once and have the compiler implement and enforce it across your codebase, so the repetitive code never lands in your source files. Both are updated for each new version of .NET, C#, and Visual Studio.

Which One Do I Use?

  • You already build on PostSharp aspects. Keep shipping with PostSharp, the proven MSIL-based aspect-oriented framework for .NET. No migration is needed.
  • You are applying patterns and architecture rules to any C# codebase. Use Metalama, our open-source patterns & architecture toolkit for C#, built on Roslyn.

Every PostSharp subscription is a dual license: PostSharp and Metalama Professional, one seat, one renewal.

What You Can Do

  • Cut the boilerplate. Aspects generate the repetitive code during compilation, so it never enters your source files or your review queue.
  • Enforce your architecture as you type. Express dependency rules, naming conventions, and pattern guidelines in plain C#, and see violations in the editor rather than in code review.

How Metalama Works

1. Add a Package to Your Project

Add the Metalama.Framework package to your project.

2. Write an Aspect Class, or Use a Ready-Made One

Aspects are meta-classes that transform code using plain C# templates. They can also report warnings and errors, or suggest code fixes.

Here is an aspect that adds logging to a method:

Logging Aspect

This is the simplest possible example. Ready-made aspects are available on the Metalama Marketplace to use as they are or to adapt.

3a. Apply Aspects One at a Time

You can apply an aspect individually using a custom attribute.

Adding Aspect As Attribute

3b. Apply Aspects in Bulk

Or you can apply aspects in bulk using compile-time, LINQ-like code.

Adding Aspect With a Fabric

4. Build

At compile time, Metalama merges the aspect template with your business code. Your source files are left untouched.

Generated Code

What Features Does This Extension Add?

Metalama and PostSharp are distributed as NuGet packages and do not require an IDE extension. This extension adds the following to Visual Studio:

Metalama Diff

Compare your source code with the generated code.

Metalama Diff

CodeLens

See at a glance when an aspect is affecting your code.

CodeLens

Aspect Explorer

Browse the aspects available in the current solution and see their effect on your code.

Aspect Explorer

T# Syntax Highlighting

T# is Metalama's C#-to-C# template language. It is 100% C#-compatible; the syntax highlighting distinguishes code that runs at compile time from code that runs at run time.

Syntax Highlighting

PostSharp Debugging Helper

A debugging helper for PostSharp-based projects.

What Else Can Metalama Do?

Validate Architecture

Express your architecture in code and have it enforced in real time, in the editor. In this example, the internals of the current namespace may not be accessed from a different namespace, except by tests.

Validate Architecture

Report Errors and Warnings from Aspects

Any aspect can report an error or a warning when it detects a violation.

Report Diagnostics

Suggest Code Fixes

Aspects can attach code fix suggestions to errors and warnings, and offer refactorings.

Suggest Code Fixes

Use Generated Code From Source Code

Code generated by an aspect is visible to IntelliSense and can be referenced from your own source code.

Use Generated Code From Source Code

Leave Whenever You Want

The metalama divorce command writes the generated code back into your source files, leaving you with plain C# and no dependency on Metalama.

Divorce

Test Your Aspects

Metalama includes a testing framework, so you can test your aspects before distributing them to your team.

Test Your Aspects

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft