Microsoft.Extensions.Hosting 8.0.0

About

Contains the .NET Generic Host HostBuilder which layers on the Microsoft.Extensions.Hosting.Abstractions package.

Key Features

  • Contains the .NET Generic Host HostBuilder.

How to Use

For a console app project:

    using (IHost host = new HostBuilder().Build())
    {
        var lifetime = host.Services.GetRequiredService<IHostApplicationLifetime>();
    
        lifetime.ApplicationStarted.Register(() =>
        {
            Console.WriteLine("Started");
        });
        lifetime.ApplicationStopping.Register(() =>
        {
            Console.WriteLine("Stopping firing");
            Console.WriteLine("Stopping end");
        });
        lifetime.ApplicationStopped.Register(() =>
        {
            Console.WriteLine("Stopped firing");
            Console.WriteLine("Stopped end");
        });
    
        host.Start();
    
        // Listens for Ctrl+C.
        host.WaitForShutdown();
    }

Main Types

The main types provided by this library are:

  • Microsoft.Extensions.Host.
  • Microsoft.Extensions.Hosting.HostApplicationBuilder
  • Microsoft.Extensions.Hosting.HostBuilder
  • Microsoft.Extensions.Hosting.IHostedService
  • Microsoft.Extensions.Hosting.IHostedLifecycleService

Additional Documentation

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

Feedback & Contributing

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

Packages Downloads
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/3eeb12e106b9e913c3a4dec1a7d16da7b74149eb
814
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/3f1acb59718cadf111a0a796681e3d3509bb3381
488
Quantum.Framework.Core.StandardLib
Package Description
92
Quantum.Framework.Core.StandardLib
Package Description
95
Quantum.Framework.Core.StandardLib
Package Description
100
Quantum.Framework.Core.StandardLib
Package Description
107
Quantum.Framework.Core.StandardLib
Package Description
111
Quantum.Framework.Core.StandardLib
Package Description
117
Quantum.Framework.Core.StandardLib
Package Description
121
Quantum.Framework.Core.StandardLib
Package Description
122
Quantum.Framework.Core.StandardLib
Package Description
126
Quantum.Framework.Core.StandardLib
Package Description
127
Quantum.Framework.Core.StandardLib
Package Description
133
Quantum.Framework.Core.StandardLib
Package Description
135
Quantum.Framework.Core.StandardLib
Package Description
172
Quantum.Framework.Core.StandardLib
Package Description
187
Quantum.Framework.Core.StandardLib
Package Description
217
Quantum.Framework.Core.StandardLib
Package Description
260
Quantum.Framework.Core.StandardLib
Package Description
378
Xunit.DependencyInjection
Use Microsoft.Extensions.DependencyInjection to inject xunit testclass. If you want write Microsoft.Extensions.Logging to ITestOutputHelper, please install Xunit.DependencyInjection.Logging Release notes: 7.0: Add fixture injection and refactor DependencyInjectionTestFramework, you don't have to declare the [assembly: TestFrameworkAttribute] on normal case.
309

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

.NET Framework 4.6.2

.NET Standard 2.0

.NET 8.0

.NET Standard 2.1

.NET 7.0

.NET 6.0

Version Downloads Last updated
10.0.0 25 11/13/2025
10.0.0-rc.2.25502.107 18 10/21/2025
10.0.0-rc.1.25451.107 21 09/12/2025
10.0.0-preview.7.25380.108 22 08/14/2025
10.0.0-preview.6.25358.103 17 07/16/2025
10.0.0-preview.5.25277.114 23 06/09/2025
10.0.0-preview.4.25258.110 23 05/15/2025
10.0.0-preview.3.25171.5 27 04/12/2025
10.0.0-preview.2.25163.2 27 03/24/2025
10.0.0-preview.1.25080.5 20 03/15/2025
9.0.11 10 11/13/2025
9.0.10 14 10/18/2025
9.0.9 17 09/13/2025
9.0.8 16 08/13/2025
9.0.7 17 07/09/2025
9.0.6 20 06/14/2025
9.0.5 26 05/16/2025
9.0.4 25 04/12/2025
9.0.3 25 03/31/2025
9.0.2 32 02/18/2025
9.0.1 32 01/14/2025
9.0.0 43 11/18/2024
9.0.0-rc.2.24473.5 31 11/05/2024
9.0.0-rc.1.24431.7 31 11/25/2024
9.0.0-preview.7.24405.7 24 12/02/2024
9.0.0-preview.6.24327.7 29 11/27/2024
9.0.0-preview.5.24306.7 24 11/26/2024
9.0.0-preview.4.24266.19 35 05/22/2024
9.0.0-preview.3.24172.9 34 05/20/2024
9.0.0-preview.2.24128.5 35 05/05/2024
9.0.0-preview.1.24080.9 37 05/09/2024
8.0.1 33 11/28/2024
8.0.0 234 02/04/2024
8.0.0-rc.2.23479.6 36 05/09/2024
8.0.0-rc.1.23419.4 28 05/09/2024
8.0.0-preview.7.23375.6 29 05/28/2024
8.0.0-preview.6.23329.7 41 08/08/2023
8.0.0-preview.5.23280.8 34 05/28/2024
8.0.0-preview.4.23259.5 36 05/09/2024
8.0.0-preview.3.23174.8 36 05/22/2024
8.0.0-preview.2.23128.3 24 05/09/2024
8.0.0-preview.1.23110.8 30 05/09/2024
7.0.1 42 07/13/2023
7.0.0 46 02/02/2023
7.0.0-rc.2.22472.3 28 05/28/2024
7.0.0-rc.1.22426.10 32 05/09/2024
7.0.0-preview.7.22375.6 32 05/28/2024
7.0.0-preview.6.22324.4 32 05/28/2024
7.0.0-preview.5.22301.12 31 05/28/2024
7.0.0-preview.4.22229.4 32 05/09/2024
7.0.0-preview.2.22152.2 29 05/28/2024
7.0.0-preview.1.22076.8 32 05/28/2024
6.0.2-mauipre.1.22102.15 24 05/22/2024
6.0.2-mauipre.1.22054.8 29 05/28/2024
6.0.0-rc.2.21480.5 37 05/28/2024
6.0.0-rc.1.21451.13 32 05/28/2024
6.0.0-preview.5.21301.5 34 05/22/2024
6.0.0-preview.4.21253.7 30 05/11/2022
6.0.0-preview.3.21201.4 26 11/21/2024
6.0.0-preview.2.21154.6 32 05/22/2024
6.0.0-preview.1.21102.12 30 05/28/2024
5.0.0 32 05/28/2024
5.0.0-rc.2.20475.5 33 05/28/2024
5.0.0-rc.1.20451.14 30 05/28/2024
5.0.0-preview.7.20364.11 32 05/28/2024
5.0.0-preview.4.20251.6 33 05/22/2024
5.0.0-preview.3.20215.2 26 05/28/2024
5.0.0-preview.2.20160.3 26 05/22/2024
5.0.0-preview.1.20120.4 32 05/22/2024
3.1.32 9,122 05/12/2023
3.1.31 28 11/28/2024
3.1.30 5,365 11/03/2022
3.1.29 34 05/15/2024
3.1.28 26 05/09/2024
3.1.27 23 11/25/2024
3.1.26 30 05/17/2024
3.1.25 35 05/09/2024
3.1.20 25 11/28/2024
3.1.19 28 11/10/2024
3.1.18 22 11/21/2024
3.1.15 25 11/09/2024
3.1.4 33 05/28/2024
3.1.2 45 06/15/2022
3.1.1 36 05/28/2024
3.1.0-preview3.19553.2 29 05/28/2024
3.1.0-preview2.19525.4 33 05/28/2024
3.1.0-preview1.19506.1 35 05/28/2024
3.0.0-rc1.19456.10 26 05/28/2024
3.0.0-preview8.19405.4 27 05/28/2024
3.0.0-preview7.19362.4 23 05/28/2024
3.0.0-preview3.19153.1 32 05/28/2024
3.0.0-preview.18572.1 28 05/28/2024
2.2.0-preview3-35497 35 05/28/2024
2.2.0-preview1-35029 32 05/28/2024
2.1.0 184 06/25/2022
2.1.0-rc1-final 32 05/28/2024
2.1.0-preview2-final 29 05/11/2022
2.1.0-preview1-final 31 05/28/2024