System.Composition 10.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/205504dfd0f686370cffae5df068024c8a2b427f.
110
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/20b9af913f1b8ce0a62f72bea9e75e4aa3cf6b0e.
110
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.
101
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.
103
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/43b0b05cc4f492fd5de00f6f6717409091df8daa.
140
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/5905d757a89126ebbcdb383b1a10cadda8c6fdc3.
108
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.
140
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/692d17e98436dfde74109aefe78f3507ae6c5b36.
104
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.
122
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/b8a5611e3db4f7ac3b5e1404b129304b5baf843e.
101
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/be9c072e1c8a9e6701e34d796b1d68098d08feab.
107
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/ce8ac3f71fa4c73b78cf8218d58b322bdbdfa1c9.
102
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/cf82d399c36008e7936d545cde24141f8d3790fa.
121
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/dfa7fc6bdea31a858a402168384192b633c811fa.
119
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.
140
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/f99bb16a395e48a05520ba7af1549b20bfdeee36.
115
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
108
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/2b7d172669b2f7e55803b55f317cfcc2d4279d76.
106
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/bf8791d0d1be92c24e56cefa52aa139e2b5340c2.
102
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.
126

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

Version Downloads Last updated
10.0.0 39 11/15/2025
10.0.0-rc.2.25502.107 41 10/15/2025
10.0.0-rc.1.25451.107 39 09/11/2025
10.0.0-preview.7.25380.108 34 08/14/2025
10.0.0-preview.6.25358.103 68 07/17/2025
10.0.0-preview.5.25277.114 42 06/07/2025
10.0.0-preview.4.25258.110 32 05/17/2025
10.0.0-preview.3.25171.5 41 04/14/2025
10.0.0-preview.2.25163.2 37 03/30/2025
10.0.0-preview.1.25080.5 51 03/15/2025
9.0.11 35 11/16/2025
9.0.10 31 10/15/2025
9.0.9 33 09/12/2025
9.0.8 37 08/11/2025
9.0.7 62 07/10/2025
9.0.6 38 06/14/2025
9.0.5 46 05/18/2025
9.0.4 37 04/14/2025
9.0.3 39 03/15/2025
9.0.2 80 03/15/2025
9.0.1 41 01/27/2025
9.0.0 51 11/14/2024
9.0.0-rc.2.24473.5 43 11/27/2024
9.0.0-rc.1.24431.7 79 11/09/2024
9.0.0-preview.7.24405.7 83 12/05/2024
9.0.0-preview.6.24327.7 43 12/04/2024
9.0.0-preview.5.24306.7 40 12/06/2024
9.0.0-preview.4.24266.19 49 05/28/2024
9.0.0-preview.3.24172.9 53 05/10/2024
9.0.0-preview.2.24128.5 46 05/28/2024
9.0.0-preview.1.24080.9 54 05/28/2024
8.0.0 56 05/28/2024
8.0.0-rc.2.23479.6 48 05/28/2024
8.0.0-rc.1.23419.4 47 05/28/2024
8.0.0-preview.7.23375.6 47 05/28/2024
8.0.0-preview.6.23329.7 45 05/28/2024
8.0.0-preview.5.23280.8 43 05/28/2024
8.0.0-preview.4.23259.5 56 06/04/2023
8.0.0-preview.3.23174.8 53 05/28/2024
8.0.0-preview.2.23128.3 41 05/28/2024
8.0.0-preview.1.23110.8 51 05/28/2024
7.0.0 49 05/28/2024
7.0.0-rc.2.22472.3 50 05/28/2024
7.0.0-rc.1.22426.10 42 05/28/2024
7.0.0-preview.7.22375.6 53 05/28/2024
7.0.0-preview.6.22324.4 64 05/28/2024
7.0.0-preview.5.22301.12 45 05/28/2024
7.0.0-preview.4.22229.4 43 05/28/2024
7.0.0-preview.3.22175.4 53 05/28/2024
7.0.0-preview.2.22152.2 46 05/28/2024
7.0.0-preview.1.22076.8 44 05/28/2024
6.0.2-mauipre.1.22102.15 43 05/28/2024
6.0.2-mauipre.1.22054.8 47 05/28/2024
6.0.0 65 02/01/2023
6.0.0-rc.2.21480.5 44 05/28/2024
6.0.0-rc.1.21451.13 51 05/28/2024
6.0.0-preview.7.21377.19 52 05/28/2024
6.0.0-preview.6.21352.12 45 05/28/2024
6.0.0-preview.5.21301.5 91 05/28/2024
6.0.0-preview.4.21253.7 44 05/28/2024
6.0.0-preview.3.21201.4 58 05/28/2024
6.0.0-preview.2.21154.6 48 05/28/2024
6.0.0-preview.1.21102.12 51 05/28/2024
5.0.1 53 06/29/2023
5.0.0 52 05/28/2024
5.0.0-rc.2.20475.5 45 05/28/2024
5.0.0-rc.1.20451.14 47 05/28/2024
5.0.0-preview.8.20407.11 53 05/28/2024
5.0.0-preview.7.20364.11 52 05/28/2024
5.0.0-preview.6.20305.6 49 05/28/2024
5.0.0-preview.5.20278.1 51 05/28/2024
5.0.0-preview.4.20251.6 48 05/28/2024
5.0.0-preview.3.20214.6 46 05/28/2024
5.0.0-preview.2.20160.6 46 05/28/2024
5.0.0-preview.1.20120.5 42 05/28/2024
1.4.1 56 05/28/2024
1.4.0 52 05/28/2024
1.4.0-preview3.19551.4 52 05/28/2024
1.4.0-preview2.19523.17 52 05/28/2024
1.4.0-preview1.19504.10 46 05/28/2024
1.3.0 53 05/28/2024
1.3.0-rc1.19456.4 44 05/28/2024
1.3.0-preview9.19421.4 43 05/28/2024
1.3.0-preview9.19416.11 57 05/28/2024
1.3.0-preview8.19405.3 51 05/28/2024
1.3.0-preview7.19362.9 81 05/28/2024
1.3.0-preview6.19303.8 50 05/28/2024
1.3.0-preview6.19264.9 49 05/28/2024
1.3.0-preview5.19224.8 44 05/28/2024
1.3.0-preview4.19212.13 46 05/28/2024
1.3.0-preview3.19128.7 46 05/28/2024
1.3.0-preview.19073.11 49 05/28/2024
1.3.0-preview.18571.3 51 05/28/2024
1.2.0 49 05/28/2024
1.2.0-rc1 54 05/28/2024
1.2.0-preview2-26406-04 54 05/28/2024
1.2.0-preview1-26216-02 48 05/28/2024
1.1.0 51 05/28/2024
1.1.0-preview2-25405-01 51 05/28/2024
1.1.0-preview1-25305-02 49 05/28/2024
1.0.31 103 05/05/2022
1.0.31-preview1-24530-04 52 05/28/2024