System.Composition.Hosting 10.0.0

About

System.Composition.Hosting is part of the Managed Extensibility Framework (MEF) 2.0, a composition library for .NET that enables dependency injection through attributes or conventions.

This package provides core services for creating composition containers. It offers tools to configure and manage the composition of parts within your application, facilitating dependency injection and enabling modular architectures.

Key Features

  • Create and manage composition containers for dynamic dependency injection.

How to Use

Create a composition host and compose parts.

using System.Composition;
using System.Composition.Hosting;

// Create a container configuration
var configuration = new ContainerConfiguration()
    .WithPart<Service>();

// Create the composition host (container)
using CompositionHost container = configuration.CreateContainer();

// Get an instance of the service
var service = container.GetExport<IService>();
service.Run();
// Service is running!

public interface IService
{
    void Run();
}

[Export(typeof(IService))]
public class Service : IService
{
    public void Run() => Console.WriteLine("Service is running!");
}

Main Types

The main type provided by this library is:

  • System.Composition.CompositionHost

Additional Documentation

Feedback & Contributing

System.Composition.Hosting 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.Hosting.

Packages Downloads
Microsoft.VisualStudio.Utilities
A member of the Visual Studio SDK
73
Microsoft.VisualStudio.Utilities
A member of the Visual Studio SDK
75
Microsoft.VisualStudio.Utilities
A member of the Visual Studio SDK
93
System.Composition
Provides a version of the Managed Extensibility Framework (MEF) that is lightweight and specifically optimized for high throughput scenarios, such as the web.
81
System.Composition
This package provides a version of the Managed Extensibility Framework (MEF) that is lightweight and specifically optimized for high throughput scenarios, such as the web. Commonly Used Types: System.Composition.ExportAttribute System.Composition.ImportAttribute System.Composition.Convention.ConventionBuilder System.Composition.Hosting.CompositionHost System.Composition.CompositionContext System.Composition.CompositionContextExtensions
83
System.Composition
This package provides a version of the Managed Extensibility Framework (MEF) that is lightweight and specifically optimized for high throughput scenarios, such as the web. Commonly Used Types: System.Composition.ExportAttribute System.Composition.ImportAttribute System.Composition.Convention.ConventionBuilder System.Composition.Hosting.CompositionHost System.Composition.CompositionContext System.Composition.CompositionContextExtensions
87
System.Composition
This packages provides a version of the Managed Extensibility Framework (MEF) that is lightweight and specifically optimized for high throughput scenarios, such as the web. Commonly Used Types: System.Composition.ExportAttribute System.Composition.ImportAttribute System.Composition.Convention.ConventionBuilder System.Composition.Hosting.CompositionHost System.Composition.CompositionContext System.Composition.CompositionContextExtensions
95
System.Composition
This packages provides a version of the Managed Extensibility Framework (MEF) that is lightweight and specifically optimized for high throughput scenarios, such as the web. Commonly Used Types: System.Composition.ExportAttribute System.Composition.ImportAttribute System.Composition.Convention.ConventionBuilder System.Composition.Hosting.CompositionHost System.Composition.CompositionContext System.Composition.CompositionContextExtensions When using NuGet 3.x this package requires at least version 3.4.
86
System.Composition
This packages provides a version of the Managed Extensibility Framework (MEF) that is lightweight and specifically optimized for high throughput scenarios, such as the web. Commonly Used Types: System.Composition.ExportAttribute System.Composition.ImportAttribute System.Composition.Convention.ConventionBuilder System.Composition.Hosting.CompositionHost System.Composition.CompositionContext System.Composition.CompositionContextExtensions When using NuGet 3.x this package requires at least version 3.4.
117
System.Composition.TypedParts
Provides container configuration and some extension methods for the Managed Extensibility Framework (MEF).
77
System.Composition.TypedParts
Provides some extension methods for the Managed Extensibility Framework. Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration
83
System.Composition.TypedParts
Provides some extension methods for the Managed Extensibility Framework. Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration
87
System.Composition.TypedParts
Provides some extension methods for the Managed Extensibility Framework. Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration
99
System.Composition.TypedParts
Provides some extension methods for the Managed Extensibility Framework. Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration
104
System.Composition.TypedParts
Provides some extension methods for the Managed Extensibility Framework. Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration When using NuGet 3.x this package requires at least version 3.4.
80
System.Composition.TypedParts
Provides some extension methods for the Managed Extensibility Framework. Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration When using NuGet 3.x this package requires at least version 3.4.
82
System.Composition.TypedParts
Provides some extension methods for the Managed Extensibility Framework. Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration When using NuGet 3.x this package requires at least version 3.4.
97
System.Composition.TypedParts
Provides some extension methods for the Managed Extensibility Framework. Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration When using NuGet 3.x this package requires at least version 3.4.
109
System.Composition.TypedParts
Provides some extension methods for the Managed Extensibility Framework. Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration When using NuGet 3.x this package requires at least version 3.4.
118

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

.NET Framework 4.6.2

.NET 8.0

.NET 9.0

.NET 10.0

.NET Standard 2.0

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