System.Composition 10.0.0-preview.4.25255.103

This is a prerelease version of System.Composition.
dotnet add package System.Composition --version 10.0.0-preview.4.25255.103
                    
NuGet\Install-Package System.Composition -Version 10.0.0-preview.4.25255.103
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="System.Composition" Version="10.0.0-preview.4.25255.103" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="System.Composition" Version="10.0.0-preview.4.25255.103" />
                    
Directory.Packages.props
<PackageReference Include="System.Composition" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add System.Composition --version 10.0.0-preview.4.25255.103
                    
#r "nuget: System.Composition, 10.0.0-preview.4.25255.103"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=System.Composition&version=10.0.0-preview.4.25255.103&prerelease
                    
Install System.Composition as a Cake Addin
#tool nuget:?package=System.Composition&version=10.0.0-preview.4.25255.103&prerelease
                    
Install System.Composition as a Cake Tool

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.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 is compatible.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

GitHub repositories (55)

Showing the top 20 popular GitHub repositories that depend on System.Composition:

Repository Stars
BeyondDimension/SteamTools
🛠「Watt Toolkit」是一个开源跨平台的多功能 Steam 工具箱。
dotnet/roslyn
The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
JustArchiNET/ArchiSteamFarm
C# application with primary purpose of farming Steam cards from multiple accounts simultaneously.
dotnet/machinelearning
ML.NET is an open source and cross-platform machine learning framework for .NET.
dotnet/docfx
Static site generator for .NET API documentation.
roslynpad/roslynpad
A cross-platform C# editor based on Roslyn and AvalonEdit
neuecc/Utf8Json
Definitely Fastest and Zero Allocation JSON Serializer for C#(NET, .NET Core, Unity, Xamarin).
apache/lucenenet
Apache Lucene.NET
rubberduck-vba/Rubberduck
Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
OmniSharp/omnisharp-roslyn
OmniSharp server (HTTP, STDIO) based on Roslyn workspaces
VitalElement/AvalonStudio
Cross platform IDE and Shell
KirillOsenkov/SourceBrowser
Source browser website generator that powers https://source.dot.net, https://referencesource.microsoft.com and https://sourceroslyn.io
security-code-scan/security-code-scan
Vulnerability Patterns Detector for C# and VB.NET
danielpalme/IocPerformance
Performance comparison of .NET IoC containers
microsoft/binskim
A binary static analysis tool that provides security and correctness results for Windows Portable Executable and *nix ELF binary formats
dotnet/arcade
Tools that provide common build infrastructure for multiple .NET Foundation projects.
icsharpcode/RefactoringEssentials
Refactoring Essentials for Visual Studio
chummer5a/chummer5a
Character generator for Shadowrun 5th edition
Code52/pretzel
A site generation tool (and then some) for .NET platforms
FortuneN/FineCodeCoverage
Visualize unit test code coverage easily for free in Visual Studio Community Edition (and other editions too)
Version Downloads Last updated
10.0.0-preview.4.25255.103 0 5/12/2025
1.3.0-preview.19073.11 2 1/28/2019
1.3.0-preview.18571.3 1 11/30/2018