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
.NET Compiler Platform ("Roslyn"). This is the all-in-one package (a superset of all assemblies). You can install any of these sub-packages if you only want part of the functionality: - "Microsoft.CodeAnalysis.CSharp.Workspaces" (C# compiler + services) - "Microsoft.CodeAnalysis.VisualBasic.Workspaces" (VB compiler + services) - "Microsoft.CodeAnalysis.Compilers" (both compilers) - "Microsoft.CodeAnalysis.CSharp" (only the C# compiler) - "Microsoft.CodeAnalysis.VisualBasic (only the VB compiler) More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/bf8791d0d1be92c24e56cefa52aa139e2b5340c2.
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/34202cc2f3e869fd70a26d8237f4552cf9e192cf.
10
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/66a912c9463eebe832cf742d2fe8bb2e1a4600ec.
52
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.
15
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/8de9e4b2beba5b7c0edd6f1e6a4f192a51fdc872.
10
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/e091728607ca0fc9efca55ccfb3e59259c6b5a0a.
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. This package was built from the source at https://github.com/dotnet/roslyn/commit/57c813192bd494bb15aaa841f415f28f50438e19
16
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
14
Microsoft.VisualStudio.Composition
Lightning fast MEF engine, supporting System.ComponentModel.Composition and System.Composition.
13
Microsoft.VisualStudio.Imaging
A member of the Visual Studio SDK
11
Microsoft.VisualStudio.LiveShare
Enables VS extensions to access Live Share capabilities.
11
Microsoft.VisualStudio.LiveShare
Enables VS extensions to access Live Share capabilities.
16
Microsoft.VisualStudio.LiveShare.LanguageServices
Enables VS language service extensions to integrate with Live Share.
10
Microsoft.VisualStudio.LiveShare.LanguageServices
Enables VS language service extensions to integrate with Live Share.
11
Microsoft.VisualStudio.ProjectSystem
Reference assemblies for Visual Studio Project System Extensibility
11
Microsoft.VisualStudio.SDK
Visual Studio SDK meta-package. Reference this to get references to most other Visual Studio extensibility packages.
15
Microsoft.VisualStudio.Utilities
A member of the Visual Studio SDK
11
Microsoft.VisualStudio.Utilities
A member of the Visual Studio SDK
12
Microsoft.VisualStudio.Utilities
A member of the Visual Studio SDK
14

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

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