Microsoft.Extensions.Hosting 9.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
SanedBuildingBlocks
This package built for OIG-Saned
3,442
SanedBuildingBlocks
This package built for OIG-Saned
2,443
SanedBuildingBlocks
This package built for OIG-Saned
916
SanedBuildingBlocks
This package built for OIG-Saned
838
SanedBuildingBlocks
This package built for OIG-Saned
764
SanedBuildingBlocks
This package built for OIG-Saned
652
SanedBuildingBlocks
This package built for OIG-Saned
460
SanedBuildingBlocks
This package built for OIG-Saned
428
SanedBuildingBlocks
This package built for OIG-Saned
281
SanedBuildingBlocks
This package built for OIG-Saned
273
SanedBuildingBlocks
This package built for OIG-Saned
236
SanedBuildingBlocks
This package built for OIG-Saned
233
SanedBuildingBlocks
This package built for OIG-Saned
196
SanedBuildingBlocks
This package built for OIG-Saned
191
SanedBuildingBlocks
This package built for OIG-Saned
188
SanedBuildingBlocks
This package built for OIG-Saned
186
SanedBuildingBlocks
This package built for OIG-Saned
171
SanedBuildingBlocks
This package built for OIG-Saned
150
SanedBuildingBlocks
This package built for OIG-Saned
131
SanedBuildingBlocks
This package built for OIG-Saned
126

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.0 21 12/01/2024
7.0.0 19 06/26/2023
6.0.1 18 06/19/2023