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/73165d0e9db050da8c46cc375565c9959a5f17e5.
43
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/2242fa4fb945b97680bdd49eb5dd58285e4abb1c.
39
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/e873e69306527a0424e97af2985370556f474019
38
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/9d80dea7fe1b14043b9b2ac4d0b59ed26f508742.
36
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/b90347a69117be7181e2f03a991790634981eddb.
35
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.
34
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/1ce8866c9de4c2d67351ef6863699dee03b0804a.
29
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.
29
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/ae1fff344d46976624e68ae17164e0607ab68b10.
26
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/231aeb8be8357239499d45c0574e5a9a8c9174f0.
25
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/7a63d79b60ffb33e919bee8056816f8f449d00ce.
25
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/e68227ea677b76a3c603bd616f03ea6d952b2458.
25
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/9081e399a13297f6e2fd37cb06ca82ffba3eed21
23
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.
22
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/e482b6e281d7db727fcb086ebbfae44dcba82c6d.
22
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/75d31ee941ce4dbbe5752f4ac2d5c0583f388a27.
20
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/2fc92d84e746c3aab75f0930278ea6675cd5bb5c.
18
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/eb0a7ff1c241695e17b07b096593804fdd5cfcfd.
16
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/df45061e218c9b5813c5531bc06fb238a23e30f6.
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/416f7c5a54bcf5c34eaf69ffa04cf3f12435b153.
15

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

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