Microsoft.Extensions.Hosting 10.0.7

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.

No packages depend on Microsoft.Extensions.Hosting.

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

.NET Framework 4.6.2

.NET Standard 2.0

.NET 10.0

.NET Standard 2.1

.NET 9.0

.NET 8.0

Version Downloads Last updated
10.0.7 1 6/20/2026
10.0.6 1 6/20/2026
10.0.5 1 6/20/2026
10.0.2 1 6/20/2026
10.0.1 1 6/20/2026
10.0.0 1 6/20/2026
9.0.17 1 6/20/2026
9.0.16 1 6/20/2026
9.0.13 1 6/20/2026
9.0.12 1 6/20/2026
9.0.11 1 6/20/2026
9.0.10 1 6/20/2026
9.0.9 1 6/20/2026
9.0.6 1 6/20/2026
9.0.5 1 6/20/2026
8.0.0 7 10/5/2025
7.0.0-preview.3.22175.4 1 6/20/2026
6.0.1 1 6/20/2026
5.0.0-preview.3.20215.2 1 6/20/2026
3.1.31 1 6/20/2026
3.1.27 1 6/20/2026
3.1.26 1 6/20/2026
3.1.25 1 6/20/2026
3.1.24 1 6/20/2026
3.1.23 1 6/20/2026
3.1.20 1 6/20/2026
3.1.19 1 6/20/2026
3.1.16 1 6/20/2026
3.1.15 1 6/20/2026
3.1.12 1 6/20/2026
3.1.7 1 6/20/2026
3.1.2 1 6/20/2026
2.2.0-preview1-35029 1 6/20/2026