System.Composition 9.0.0

About

Provides the Managed Extensibility Framework (MEF) 2.0, a lightweight, attribute-driven Dependency Injection (DI) container.

MEF simplifies the composition of applications by allowing components to be loosely coupled and dynamically discovered. This package supports the development of modular and maintainable applications by enabling parts to be composed at runtime.

Key Features

  • Components are discovered and composed using attributes.
  • Provides dependency injection capabilities for loosely coupled modules.

How to Use

Running code from a discovered component.

using System.Composition;
using System.Composition.Hosting;

var configuration = new ContainerConfiguration().WithPart<Service>();

using var container = configuration.CreateContainer();

var service = container.GetExport<Service>();
service.Execute();
// Output: Service is running!

[Export]
public class Service
{
    public void Execute() => Console.WriteLine("Service is running!");
}

Main Types

The main types provided by this library are:

  • System.Composition.ExportAttribute
  • System.Composition.ImportAttribute
  • System.Composition.Convention.ConventionBuilder
  • System.Composition.Hosting.CompositionHost
  • System.Composition.CompositionContext
  • System.Composition.CompositionContextExtensions

Additional Documentation

Feedback & Contributing

System.Composition is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Showing the top 20 packages that depend on System.Composition.

Packages Downloads
Microsoft.CodeAnalysis.Workspaces.Common
A shared package used by the .NET Compiler Platform ("Roslyn") including support for analyzing projects and solutions. Do not install this package manually, it will be added as a prerequisite by other packages that require it. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/6a5a63bbc9f4449d9bd1e95a8f9624939c3ccdc3.
840
Microsoft.CodeAnalysis.Workspaces.MSBuild
.NET Compiler Platform ("Roslyn") support for analyzing MSBuild projects and solutions. This should be used with at least one of the following packages to add the appropriate language support: - Microsoft.CodeAnalysis.CSharp.Workspaces - Microsoft.CodeAnalysis.VisualBasic.Workspaces More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/fa72fa61b0d822ea8a3fbeb96f668340419ab5cd.
11
Microsoft.CodeAnalysis.Workspaces.Common
A shared package used by the .NET Compiler Platform ("Roslyn") including support for analyzing projects and solutions. Do not install this package manually, it will be added as a prerequisite by other packages that require it. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/d3f6b8e7e17ebc52a62150db7bb952daf0dc2c29
8
Microsoft.CodeAnalysis.Features
.NET Compiler Platform ("Roslyn") support for creating editing experiences. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/fa72fa61b0d822ea8a3fbeb96f668340419ab5cd.
8
Microsoft.CodeAnalysis.VisualBasic.Workspaces
.NET Compiler Platform ("Roslyn") support for analyzing Visual Basic projects and solutions. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/f99bb16a395e48a05520ba7af1549b20bfdeee36.
8
Microsoft.CodeAnalysis.CSharp.Workspaces
.NET Compiler Platform ("Roslyn") support for analyzing C# projects and solutions. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/cf82d399c36008e7936d545cde24141f8d3790fa.
8
Microsoft.CodeAnalysis.CSharp.Workspaces
.NET Compiler Platform ("Roslyn") support for analyzing C# projects and solutions. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/bf8791d0d1be92c24e56cefa52aa139e2b5340c2.
7
Microsoft.CodeAnalysis.VisualBasic.Workspaces
.NET Compiler Platform ("Roslyn") support for analyzing Visual Basic projects and solutions. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/fa72fa61b0d822ea8a3fbeb96f668340419ab5cd.
7
Microsoft.CodeAnalysis.Workspaces.Common
A shared package used by the .NET Compiler Platform ("Roslyn") including support for analyzing projects and solutions. Do not install this package manually, it will be added as a prerequisite by other packages that require it. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/9934fb9e3527e1c0c51314e57d4aab30f97e8f9e.
7
Microsoft.Composition
This packages provides a version of the Managed Extensibility Framework (MEF) that is lightweight and specifically optimized for high throughput scenarios, such as the web. Supported Platforms: - .NET Framework 4.5 - Windows 8 - Windows Phone 8.1 - Windows Phone Silverlight 8 - Portable Class Libraries
7
Microsoft.CodeAnalysis.Workspaces.Common
A shared package used by the .NET Compiler Platform ("Roslyn") including support for analyzing projects and solutions. Do not install this package manually, it will be added as a prerequisite by other packages that require it. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/bff1470cd9b1d44df8450e794bed97a64657c2a7
7
Microsoft.CodeAnalysis.Workspaces.Common
A shared package used by the .NET Compiler Platform ("Roslyn") including support for analyzing projects and solutions. Do not install this package manually, it will be added as a prerequisite by other packages that require it.
7
Microsoft.CodeAnalysis.CSharp.Features
.NET Compiler Platform ("Roslyn") support for creating C# editing experiences. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/f99bb16a395e48a05520ba7af1549b20bfdeee36.
7
Microsoft.CodeAnalysis.VisualBasic.Features
.NET Compiler Platform ("Roslyn") support for creating Visual Basic editing experiences. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/fa72fa61b0d822ea8a3fbeb96f668340419ab5cd.
6
Microsoft.CodeAnalysis.VisualBasic.Workspaces
.NET Compiler Platform ("Roslyn") support for analyzing Visual Basic projects and solutions. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/bf8791d0d1be92c24e56cefa52aa139e2b5340c2.
6
Microsoft.CodeAnalysis.CSharp.Features
.NET Compiler Platform ("Roslyn") support for creating C# editing experiences. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/bf8791d0d1be92c24e56cefa52aa139e2b5340c2.
6
Microsoft.CodeAnalysis.Workspaces.Common
A shared package used by the .NET Compiler Platform ("Roslyn") including support for analyzing projects and solutions. Do not install this package manually, it will be added as a prerequisite by other packages that require it. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/069a85a786acae3be2c7b49e330b7f968a624c88.
6
Microsoft.CodeAnalysis.Features
.NET Compiler Platform ("Roslyn") support for creating editing experiences. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/e482b6e281d7db727fcb086ebbfae44dcba82c6d.
6
Microsoft.CodeAnalysis.Workspaces.Common
A shared package used by the .NET Compiler Platform ("Roslyn") including support for analyzing projects and solutions. Do not install this package manually, it will be added as a prerequisite by other packages that require it. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/5e3a11e2e7f952da93f9d35bd63a2fa181c0608b.
6
Microsoft.CodeAnalysis.Features
.NET Compiler Platform ("Roslyn") support for creating editing experiences. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/5e3a11e2e7f952da93f9d35bd63a2fa181c0608b.
6

https://go.microsoft.com/fwlink/?LinkID=799421

Version Downloads Last updated
9.0.0 3 11/14/2024
9.0.0-rc.2.24473.5 1 11/14/2024
9.0.0-rc.1.24431.7 3 10/03/2024
9.0.0-preview.7.24405.7 7 08/17/2024
9.0.0-preview.6.24327.7 5 07/11/2024
9.0.0-preview.5.24306.7 5 06/21/2024
9.0.0-preview.4.24266.19 5 05/26/2024
9.0.0-preview.3.24172.9 7 04/29/2024
9.0.0-preview.2.24128.5 7 04/29/2024
9.0.0-preview.1.24080.9 7 04/29/2024
8.0.0 5 04/29/2024
8.0.0-rc.2.23479.6 6 04/29/2024
8.0.0-rc.1.23419.4 7 04/29/2024
8.0.0-preview.7.23375.6 6 04/29/2024
8.0.0-preview.6.23329.7 5 04/29/2024
8.0.0-preview.5.23280.8 5 04/29/2024
8.0.0-preview.4.23259.5 6 04/29/2024
8.0.0-preview.3.23174.8 6 04/29/2024
8.0.0-preview.2.23128.3 5 04/29/2024
8.0.0-preview.1.23110.8 5 04/29/2024
7.0.0 6 04/29/2024
7.0.0-rc.2.22472.3 7 04/04/2024
7.0.0-rc.1.22426.10 7 04/06/2024
7.0.0-preview.7.22375.6 6 04/29/2024
7.0.0-preview.6.22324.4 6 04/29/2024
7.0.0-preview.5.22301.12 4 04/29/2024
7.0.0-preview.4.22229.4 5 04/29/2024
7.0.0-preview.3.22175.4 7 04/29/2024
7.0.0-preview.2.22152.2 4 04/29/2024
7.0.0-preview.1.22076.8 4 04/29/2024
6.0.2-mauipre.1.22102.15 8 03/25/2024
6.0.2-mauipre.1.22054.8 7 03/25/2024
6.0.0 806 03/25/2024
6.0.0-rc.2.21480.5 6 04/29/2024
6.0.0-rc.1.21451.13 6 04/29/2024
6.0.0-preview.7.21377.19 7 04/29/2024
6.0.0-preview.6.21352.12 5 04/29/2024
6.0.0-preview.5.21301.5 6 04/29/2024
6.0.0-preview.4.21253.7 6 04/29/2024
6.0.0-preview.3.21201.4 8 04/29/2024
6.0.0-preview.2.21154.6 7 04/29/2024
6.0.0-preview.1.21102.12 7 04/29/2024
5.0.1 7 04/29/2024
5.0.0 5 04/29/2024
5.0.0-rc.2.20475.5 7 04/29/2024
5.0.0-rc.1.20451.14 7 04/05/2024
5.0.0-preview.8.20407.11 4 04/29/2024
5.0.0-preview.7.20364.11 6 04/29/2024
5.0.0-preview.6.20305.6 6 04/29/2024
5.0.0-preview.5.20278.1 6 05/26/2024
5.0.0-preview.4.20251.6 4 04/29/2024
5.0.0-preview.3.20214.6 6 04/29/2024
5.0.0-preview.2.20160.6 5 04/29/2024
5.0.0-preview.1.20120.5 6 04/29/2024
1.4.1 5 04/29/2024
1.4.0 6 04/03/2024
1.4.0-preview3.19551.4 6 04/29/2024
1.4.0-preview2.19523.17 5 03/25/2024
1.4.0-preview1.19504.10 7 03/25/2024
1.3.0 8 04/29/2024
1.3.0-rc1.19456.4 8 04/29/2024
1.3.0-preview9.19421.4 4 04/29/2024
1.3.0-preview9.19416.11 7 04/29/2024
1.3.0-preview8.19405.3 8 04/29/2024
1.3.0-preview7.19362.9 6 04/29/2024
1.3.0-preview6.19303.8 6 04/29/2024
1.3.0-preview6.19264.9 6 03/25/2024
1.3.0-preview5.19224.8 5 04/29/2024
1.3.0-preview4.19212.13 7 03/25/2024
1.3.0-preview3.19128.7 6 03/25/2024
1.3.0-preview.19073.11 7 04/29/2024
1.3.0-preview.18571.3 5 03/25/2024
1.2.0 6 04/29/2024
1.2.0-rc1 7 04/28/2024
1.2.0-preview2-26406-04 7 04/29/2024
1.2.0-preview1-26216-02 8 04/29/2024
1.1.0 7 04/29/2024
1.1.0-preview2-25405-01 6 05/26/2024
1.1.0-preview1-25305-02 7 04/29/2024
1.0.31 9 04/29/2024
1.0.31-preview1-24530-04 7 04/29/2024