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.CSharp.Workspaces
.NET Compiler Platform ("Roslyn") support for analyzing C# projects and solutions. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/bde21ee2b98b775b010d01a93f81ef587fe80962.
7
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/bde21ee2b98b775b010d01a93f81ef587fe80962.
6
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.
6
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/8e1779e16298415843e85029d8b52a1ae9bb4c30.
4
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.
4
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/ab56a4a6c32268d925014a3e45ddce61fba715cd
4
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/d51d1a7338e32d3a3cd1e5452665964ee8ec15df.
4
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/c94e32157c34fa777f674242cd08cfdc98737d62.
4
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/ec366687c8caead948e58704ad61ed644eb91b5b.
4
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.
4
Microsoft.CodeAnalysis.CSharp.Workspaces
.NET Compiler Platform ("Roslyn") support for analyzing C# projects and solutions. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/bf8791d0d1be92c24e56cefa52aa139e2b5340c2.
3
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/bf8791d0d1be92c24e56cefa52aa139e2b5340c2.
3
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.
3
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.
3
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.
3
Microsoft.CodeAnalysis.CSharp.Workspaces
.NET Compiler Platform ("Roslyn") support for analyzing C# projects and solutions. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/e482b6e281d7db727fcb086ebbfae44dcba82c6d.
3
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/4c32f5e4e9c0828a94fd4d1c9c0994082c85aaf3.
3
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.
3
Microsoft.CodeAnalysis.CSharp.Workspaces
.NET Compiler Platform ("Roslyn") support for analyzing C# projects and solutions. More details at https://aka.ms/roslyn-packages This package was built from the source at https://github.com/dotnet/roslyn/commit/5e3a11e2e7f952da93f9d35bd63a2fa181c0608b.
3
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/04c76c9d58c7911e2fd199da145cd97bbf283438.
3

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

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