Microsoft.Extensions.Hosting 9.0.1

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.ApplicationInsights.Kubernetes
Kubernetes support for .NET Core
37
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/b7a2ec8c7ed6b48857af0a69688a73e8c14fe6cb
35
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications. This package was built from the source code at https://github.com/aspnet/AspNetCore/tree/d12868dd7c10ff0433c16b06d3b59d03c40d987a
35
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/cdfa43bbe0ecc13757cc6517c9a253de77c3ec56
34
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/54142bcb25544b72fac28b1b061e7788c91c4f49
34
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/c0ae1d179dba6f3acd0e55be55718c97c9028698
33
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/e0d900c8649d185cf925b59bc12187a116e5e114
33
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/6a01dd1e69c8b9bd1ae005ea465ef2bcd26294bf
32
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/860072f7781a10db10fa925ea5c86d91f1e6f2c4
32
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/a5920c6656c9b8cef9e1f769c28062f0ade62f60
32
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/fe4f0d09305ca73aa19976b4521e5c4e223b080e
32
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/68bb6fb08f8f85bb3cf08953a0d2f4a254eaccff
32
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/3fe12b935c03138f76364dc877a7e069e254b5b2
32
Microsoft.AspNetCore.All
Provides a default set of APIs for building an ASP.NET Core application, and also includes API for third-party integrations with ASP.NET Core. This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download.
31
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/617d594f2bf75a8904d3d0e7d68a0bacf8e6763a
31
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/32e8c8cae5b1a4dd752d0a42a6f8a2813f75f173
31
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/50b7e9c661453874aa7a54a3985d5120564bb2e5
31
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/718171eeb4bd236ab4f0d9b1ecd97ecc63ec0be1
31
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/c911002ab43b7b989ed67090f2a48d9073d5118d
31
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
30

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

.NET Framework 4.6.2

.NET Standard 2.0

.NET 9.0

.NET Standard 2.1

.NET 8.0

Version Downloads Last updated
9.0.1 7 01/21/2025
9.0.0 11 11/13/2024
9.0.0-rc.2.24473.5 16 10/12/2024
9.0.0-rc.1.24431.7 18 09/11/2024
9.0.0-preview.7.24405.7 18 08/14/2024
9.0.0-preview.6.24327.7 16 07/11/2024
9.0.0-preview.5.24306.7 21 06/17/2024
9.0.0-preview.4.24266.19 17 05/29/2024
9.0.0-preview.3.24172.9 19 04/17/2024
9.0.0-preview.2.24128.5 20 03/17/2024
9.0.0-preview.1.24080.9 18 04/07/2024
8.0.1 15 10/14/2024
8.0.0 22 12/18/2023
8.0.0-rc.2.23479.6 19 04/09/2024
8.0.0-rc.1.23419.4 21 10/06/2023
8.0.0-preview.7.23375.6 21 09/01/2023
8.0.0-preview.6.23329.7 21 10/31/2023
8.0.0-preview.5.23280.8 21 09/18/2023
8.0.0-preview.4.23259.5 25 05/31/2023
8.0.0-preview.3.23174.8 25 05/31/2023
8.0.0-preview.2.23128.3 20 10/27/2023
8.0.0-preview.1.23110.8 24 05/31/2023
7.0.1 25 08/18/2023
7.0.0 24 08/18/2023
7.0.0-rc.2.22472.3 22 08/18/2023
7.0.0-rc.1.22426.10 25 07/05/2023
7.0.0-preview.7.22375.6 20 08/18/2023
7.0.0-preview.6.22324.4 21 08/18/2023
7.0.0-preview.5.22301.12 25 08/18/2023
7.0.0-preview.4.22229.4 18 08/18/2023
7.0.0-preview.3.22175.4 18 08/18/2023
7.0.0-preview.2.22152.2 21 08/18/2023
7.0.0-preview.1.22076.8 20 08/18/2023
6.0.2-mauipre.1.22102.15 19 08/18/2023
6.0.2-mauipre.1.22054.8 20 08/18/2023
6.0.1 22 08/18/2023
6.0.0 22 11/12/2021
6.0.0-rc.2.21480.5 23 06/24/2023
6.0.0-rc.1.21451.13 22 06/23/2023
6.0.0-preview.7.21377.19 21 08/18/2023
6.0.0-preview.6.21352.12 23 05/29/2023
6.0.0-preview.5.21301.5 23 08/18/2023
6.0.0-preview.4.21253.7 19 05/29/2023
6.0.0-preview.3.21201.4 20 05/29/2023
6.0.0-preview.2.21154.6 21 10/27/2023
6.0.0-preview.1.21102.12 25 06/23/2023
5.0.0 31 07/08/2021
5.0.0-rc.2.20475.5 24 08/18/2023
5.0.0-rc.1.20451.14 24 08/18/2023
5.0.0-preview.8.20407.11 24 05/30/2023
5.0.0-preview.7.20364.11 23 05/30/2023
5.0.0-preview.6.20305.6 28 05/29/2023
5.0.0-preview.5.20278.1 26 05/30/2023
5.0.0-preview.4.20251.6 24 05/29/2023
5.0.0-preview.3.20215.2 28 05/30/2023
5.0.0-preview.2.20160.3 25 05/30/2023
5.0.0-preview.1.20120.4 30 05/30/2023
3.1.32 19 05/31/2023
3.1.31 27 05/29/2023
3.1.30 24 05/29/2023
3.1.29 25 05/29/2023
3.1.28 23 05/29/2023
3.1.27 29 05/29/2023
3.1.26 22 05/29/2023
3.1.25 24 05/29/2023
3.1.24 23 05/29/2023
3.1.23 22 05/29/2023
3.1.22 26 05/29/2023
3.1.21 27 05/29/2023
3.1.20 24 05/29/2023
3.1.19 29 05/29/2023
3.1.18 27 05/29/2023
3.1.17 26 05/29/2023
3.1.16 27 05/29/2023
3.1.15 24 05/29/2023
3.1.14 27 05/29/2023
3.1.13 25 05/29/2023
3.1.12 23 05/29/2023
3.1.11 24 05/29/2023
3.1.10 23 05/29/2023
3.1.9 28 05/30/2023
3.1.8 20 05/30/2023
3.1.7 21 05/30/2023
3.1.6 25 05/29/2023
3.1.5 26 05/29/2023
3.1.4 23 05/31/2023
3.1.3 27 05/29/2023
3.1.2 27 05/29/2023
3.1.1 26 05/29/2023
3.1.0 27 02/19/2022
3.1.0-preview3.19553.2 19 05/29/2023
3.1.0-preview2.19525.4 24 05/29/2023
3.1.0-preview1.19506.1 26 05/29/2023
3.0.3 29 05/29/2023
3.0.2 27 05/29/2023
3.0.1 30 05/29/2023
3.0.0 22 05/29/2023
3.0.0-rc1.19456.10 23 05/29/2023
3.0.0-preview9.19423.4 23 05/29/2023
3.0.0-preview8.19405.4 22 05/29/2023
3.0.0-preview7.19362.4 24 05/29/2023
3.0.0-preview6.19304.6 22 05/29/2023
3.0.0-preview5.19227.9 24 05/29/2023
3.0.0-preview4.19216.2 21 05/29/2023
3.0.0-preview3.19153.1 21 09/30/2023
3.0.0-preview.19074.2 23 05/29/2023
3.0.0-preview.18572.1 26 11/01/2023
2.2.0 27 05/29/2023
2.2.0-preview3-35497 22 05/29/2023
2.2.0-preview2-35157 26 05/29/2023
2.2.0-preview1-35029 26 05/29/2023
2.1.1 29 05/29/2023
2.1.0 21 05/29/2023
2.1.0-rc1-final 25 05/29/2023
2.1.0-preview2-final 27 05/29/2023
2.1.0-preview1-final 36 05/29/2023