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.
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/20b9af913f1b8ce0a62f72bea9e75e4aa3cf6b0e.
125
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.
116
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/2ac1568063fc4e4501d63f8aba329023080a66ba.
123
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.
135
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.
160
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.
130
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.
158
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.
123
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.
137
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.
120
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.
123
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.
118
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.
134
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.
132
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.
151
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.
133
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
119
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.
120
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.
136

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

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