Microsoft.Extensions.DependencyInjection 9.0.4

About

Supports the dependency injection (DI) software design pattern which is a technique for achieving Inversion of Control (IoC) between classes and their dependencies.

Key Features

Provides an implementation of the DI interfaces found in the Microsoft.Extensions.DependencyInjection.Abstractions package.

How to Use

ServiceCollection services = new ();
services.AddSingleton<IMessageWriter, MessageWriter>();
using ServiceProvider provider = services.BuildServiceProvider();

// The code below, following the IoC pattern, is typically only aware of the IMessageWriter interface, not the implementation.
IMessageWriter messageWriter = provider.GetService<IMessageWriter>()!;
messageWriter.Write("Hello");

public interface IMessageWriter
{
    void Write(string message);
}

internal class MessageWriter : IMessageWriter
{
    public void Write(string message)
    {
        Console.WriteLine($"MessageWriter.Write(message: \"{message}\")");
    }
}

Main Types

The main types provided by this library are:

  • Microsoft.Extensions.DependencyInjection.DefaultServiceProviderFactory
  • Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions
  • Microsoft.Extensions.DependencyInjection.ServiceProvider

Additional Documentation

  • Microsoft.Extensions.DependencyInjection.Abstractions
  • Microsoft.Extensions.Hosting
  • Microsoft.Extensions.Options

Feedback & Contributing

Microsoft.Extensions.DependencyInjection 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 Microsoft.Extensions.DependencyInjection.

Packages Downloads
Microsoft.AspNetCore.Components.Web
Support for rendering ASP.NET Core components for browsers. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/3f1acb59718cadf111a0a796681e3d3509bb3381
17
Microsoft.AspNetCore.Components.Web
Support for rendering ASP.NET Core components for browsers. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/8486d31e24f30e3fa1809a95699a0adc16f448d7
18
Microsoft.AspNetCore.Components.Web
Support for rendering ASP.NET Core components for browsers. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/954f61dd38b33caa2b736c73530bd5a294174437
20
Microsoft.AspNetCore.Components.Web
Support for rendering ASP.NET Core components for browsers. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/af22effae4069a5dfb9b0735859de48820104f5b
29
Microsoft.AspNetCore.Mvc.Core
ASP.NET Core MVC core components. Contains common action result types, attribute routing, application model conventions, API explorer, application parts, filters, formatters, model binding, and more. Commonly used types: Microsoft.AspNetCore.Mvc.AreaAttribute Microsoft.AspNetCore.Mvc.BindAttribute Microsoft.AspNetCore.Mvc.ControllerBase Microsoft.AspNetCore.Mvc.FromBodyAttribute Microsoft.AspNetCore.Mvc.FromFormAttribute Microsoft.AspNetCore.Mvc.RequireHttpsAttribute Microsoft.AspNetCore.Mvc.RouteAttribute This package was built from the source code at https://github.com/aspnet/AspNetCore/tree/33c2d01092d9a1b7a583fe99a50b15686e2b7de9
17
Microsoft.AspNetCore.Mvc.Core
ASP.NET Core MVC core components. Contains common action result types, attribute routing, application model conventions, API explorer, application parts, filters, formatters, model binding, and more. Commonly used types: Microsoft.AspNetCore.Mvc.AreaAttribute Microsoft.AspNetCore.Mvc.BindAttribute Microsoft.AspNetCore.Mvc.ControllerBase Microsoft.AspNetCore.Mvc.FromBodyAttribute Microsoft.AspNetCore.Mvc.FromFormAttribute Microsoft.AspNetCore.Mvc.RequireHttpsAttribute Microsoft.AspNetCore.Mvc.RouteAttribute This package was built from the source code at https://github.com/aspnet/Mvc/tree/a6199bbfbab05583f987bae322fb04566841aaea
16
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
25
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
27
Microsoft.Extensions.Logging
Logging infrastructure default implementation for Microsoft.Extensions.Logging.
17
Microsoft.Extensions.Logging
Logging infrastructure default implementation for Microsoft.Extensions.Logging.
21
Microsoft.Extensions.Logging
Logging infrastructure default implementation for Microsoft.Extensions.Logging.
22
Microsoft.Extensions.Logging
Logging infrastructure default implementation for Microsoft.Extensions.Logging.
27
Microsoft.Extensions.Logging
Logging infrastructure default implementation for Microsoft.Extensions.Logging.
30
Microsoft.Extensions.Logging
Logging infrastructure default implementation for Microsoft.Extensions.Logging.
74
Microsoft.VisualStudio.Web.CodeGeneration
Contains the CodeGenCommand that finds the appropriate code generator and invokes it from project dependencies.
16
Microsoft.VisualStudio.Web.CodeGeneration
Contains the CodeGenCommand that finds the appropriate code generator and invokes it from project dependencies.
17
Microsoft.VisualStudio.Web.CodeGeneration.Core
Contains the core infrastructure used by ASP.NET Core Code Generators.
16
Microsoft.VisualStudio.Web.CodeGeneration.Design
Code Generation tool for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.
17

Version Downloads Last updated
10.0.1 2 18.12.2025
10.0.0 1 18.12.2025
10.0.0-rc.2.25502.107 3 25.10.2025
10.0.0-rc.1.25451.107 8 16.09.2025
10.0.0-preview.7.25380.108 1 18.12.2025
10.0.0-preview.6.25358.103 2 06.08.2025
10.0.0-preview.5.25277.114 7 09.06.2025
10.0.0-preview.4.25258.110 9 13.05.2025
10.0.0-preview.3.25171.5 8 02.05.2025
10.0.0-preview.2.25163.2 8 20.03.2025
10.0.0-preview.1.25080.5 10 13.03.2025
9.0.11 2 18.12.2025
9.0.10 5 25.10.2025
9.0.9 8 16.09.2025
9.0.8 27 20.08.2025
9.0.7 8 30.07.2025
9.0.6 6 26.06.2025
9.0.5 18 21.05.2025
9.0.4 10 11.05.2025
9.0.3 23 12.03.2025
9.0.2 16 17.02.2025
9.0.1 15 17.01.2025
9.0.0 31 02.12.2024
9.0.0-rc.2.24473.5 13 28.01.2025
9.0.0-rc.1.24431.7 8 23.01.2025
9.0.0-preview.7.24405.7 7 31.12.2024
9.0.0-preview.6.24327.7 6 01.01.2025
9.0.0-preview.5.24306.7 7 31.12.2024
9.0.0-preview.4.24266.19 9 01.01.2025
9.0.0-preview.3.24172.9 7 01.01.2025
9.0.0-preview.2.24128.5 8 25.07.2024
9.0.0-preview.1.24080.9 9 27.07.2024
8.0.1 21 13.11.2024
8.0.0 28 02.07.2024
8.0.0-rc.2.23479.6 8 23.01.2025
8.0.0-rc.1.23419.4 13 23.07.2024
8.0.0-preview.7.23375.6 9 24.07.2024
8.0.0-preview.6.23329.7 8 31.12.2024
8.0.0-preview.5.23280.8 10 25.07.2024
8.0.0-preview.4.23259.5 8 04.07.2024
8.0.0-preview.3.23174.8 3 13.03.2025
8.0.0-preview.2.23128.3 8 06.01.2025
8.0.0-preview.1.23110.8 10 31.12.2024
7.0.0 13 26.07.2024
7.0.0-rc.2.22472.3 13 17.07.2024
7.0.0-rc.1.22426.10 11 21.07.2024
7.0.0-preview.7.22375.6 9 31.12.2024
7.0.0-preview.6.22324.4 9 28.07.2024
7.0.0-preview.5.22301.12 10 04.07.2024
7.0.0-preview.4.22229.4 10 21.07.2024
7.0.0-preview.3.22175.4 10 04.07.2024
7.0.0-preview.2.22152.2 7 01.01.2025
7.0.0-preview.1.22076.8 8 20.07.2024
6.0.2 11 27.01.2025
6.0.1 15 26.07.2024
6.0.0 14 17.07.2024
6.0.0-rc.2.21480.5 10 13.01.2025
6.0.0-rc.1.21451.13 9 14.01.2025
6.0.0-preview.7.21377.19 6 31.12.2024
6.0.0-preview.6.21352.12 9 17.07.2024
6.0.0-preview.5.21301.5 9 04.07.2024
6.0.0-preview.4.21253.7 7 31.12.2024
6.0.0-preview.3.21201.4 10 24.07.2024
6.0.0-preview.2.21154.6 8 04.07.2024
6.0.0-preview.1.21102.12 12 24.07.2024
5.0.2 12 04.07.2024
5.0.1 11 06.01.2025
5.0.0 11 18.07.2024
5.0.0-rc.2.20475.5 9 25.07.2024
5.0.0-rc.1.20451.14 9 04.07.2024
5.0.0-preview.8.20407.11 9 04.07.2024
5.0.0-preview.7.20364.11 10 04.07.2024
5.0.0-preview.6.20305.6 8 31.12.2024
5.0.0-preview.5.20278.1 7 21.07.2024
5.0.0-preview.4.20251.6 8 16.07.2024
5.0.0-preview.3.20215.2 8 04.07.2024
5.0.0-preview.2.20160.3 10 27.07.2024
5.0.0-preview.1.20120.4 8 26.07.2024
3.1.32 11 01.01.2025
3.1.31 13 04.07.2024
3.1.30 10 13.01.2025
3.1.29 12 16.07.2024
3.1.28 13 02.01.2025
3.1.27 14 22.07.2024
3.1.26 11 27.07.2024
3.1.25 10 23.01.2025
3.1.24 12 23.07.2024
3.1.23 13 18.07.2024
3.1.22 14 04.07.2024
3.1.21 17 04.07.2024
3.1.20 11 27.07.2024
3.1.19 11 15.07.2024
3.1.18 11 13.01.2025
3.1.17 13 04.07.2024
3.1.16 13 27.07.2024
3.1.15 10 07.01.2025
3.1.14 12 16.07.2024
3.1.13 13 07.01.2025
3.1.12 13 15.07.2024
3.1.11 12 29.07.2024
3.1.10 14 23.07.2024
3.1.9 13 28.07.2024
3.1.8 11 06.01.2025
3.1.7 14 24.07.2024
3.1.6 11 04.07.2024
3.1.5 12 23.07.2024
3.1.4 10 28.01.2025
3.1.3 11 10.01.2025
3.1.2 10 31.12.2024
3.1.1 11 01.01.2025
3.1.0 15 25.07.2024
3.1.0-preview3.19553.2 10 21.07.2024
3.1.0-preview2.19525.4 8 26.07.2024
3.1.0-preview1.19506.1 10 27.07.2024
3.0.3 12 01.01.2025
3.0.2 14 04.07.2024
3.0.1 12 27.07.2024
3.0.0 12 02.01.2025
3.0.0-rc1.19456.10 11 16.07.2024
3.0.0-preview9.19423.4 7 04.07.2024
3.0.0-preview8.19405.4 8 18.07.2024
3.0.0-preview7.19362.4 7 16.07.2024
3.0.0-preview6.19304.6 6 20.07.2024
3.0.0-preview5.19227.9 9 07.01.2025
3.0.0-preview4.19216.2 7 01.01.2025
3.0.0-preview3.19153.1 13 24.07.2024
3.0.0-preview.19074.2 8 18.07.2024
3.0.0-preview.18572.1 10 04.07.2024
2.2.0 17 13.01.2025
2.2.0-preview3-35497 11 24.07.2024
2.2.0-preview2-35157 9 31.12.2024
2.2.0-preview1-35029 7 10.01.2025
2.1.1 9 06.01.2025
2.1.0 12 27.07.2024
2.1.0-rc1-final 11 27.07.2024
2.1.0-preview2-final 13 15.07.2024
2.1.0-preview1-final 11 26.07.2024
2.0.0 14 16.07.2024
2.0.0-preview2-final 13 01.01.2025
2.0.0-preview1-final 11 01.01.2025
1.1.1 13 27.07.2024
1.1.0 16 25.07.2024
1.1.0-preview1-final 12 13.01.2025
1.0.2 12 16.07.2024
1.0.1 12 04.07.2024
1.0.0 15 19.07.2024
1.0.0-rc2-final 11 31.12.2024
1.0.0-rc1-final 17 13.01.2025