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.
114
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.
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/2ac1568063fc4e4501d63f8aba329023080a66ba.
117
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.
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/43b0b05cc4f492fd5de00f6f6717409091df8daa.
153
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.
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/5e3a11e2e7f952da93f9d35bd63a2fa181c0608b.
113
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.
154
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.
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/9934fb9e3527e1c0c51314e57d4aab30f97e8f9e.
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/b8a5611e3db4f7ac3b5e1404b129304b5baf843e.
117
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.
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/ce8ac3f71fa4c73b78cf8218d58b322bdbdfa1c9.
111
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.
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/dfa7fc6bdea31a858a402168384192b633c811fa.
127
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.
147
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.
128
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
114
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.
116
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.
133

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

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