Microsoft.Extensions.Hosting 10.0.0-preview.6.25358.103

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.Azure.Functions.Worker.Core
This library provides the core functionality to build an Azure Functions .NET Worker, adding support for the isolated, out-of-process execution model.
11
Microsoft.Azure.Functions.Worker.Core
This library provides the core functionality to build an Azure Functions .NET Worker, adding support for the isolated, out-of-process execution model.
9
Microsoft.Azure.Functions.Worker
This library enables you to create an Azure Functions .NET Worker, adding support for the isolated, out-of-process execution model.
8
Microsoft.Azure.Functions.Worker.Core
This library provides the core functionality to build an Azure Functions .NET Worker, adding support for the isolated, out-of-process execution model.
8

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.0-preview.6.25358.103 9 07/16/2025
9.0.7 8 07/16/2025
9.0.1 4 07/12/2025
9.0.0-preview.4.24266.19 6 07/11/2025
8.0.0 5 07/09/2025
8.0.0-preview.1.23110.8 6 07/12/2025
7.0.0-rc.2.22472.3 6 07/13/2025
7.0.0-preview.4.22229.4 4 07/12/2025
5.0.0 5 07/12/2025
5.0.0-preview.8.20407.11 6 07/12/2025
3.1.28 4 07/09/2025
3.1.25 5 07/08/2025
3.1.20 5 07/11/2025
3.1.13 6 07/12/2025
3.1.12 6 07/13/2025
3.1.9 5 07/11/2025