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,423
SanedBuildingBlocks
This package built for OIG-Saned
2,419
SanedBuildingBlocks
This package built for OIG-Saned
912
SanedBuildingBlocks
This package built for OIG-Saned
833
SanedBuildingBlocks
This package built for OIG-Saned
753
SanedBuildingBlocks
This package built for OIG-Saned
647
SanedBuildingBlocks
This package built for OIG-Saned
456
SanedBuildingBlocks
This package built for OIG-Saned
422
SanedBuildingBlocks
This package built for OIG-Saned
276
SanedBuildingBlocks
This package built for OIG-Saned
269
SanedBuildingBlocks
This package built for OIG-Saned
221
SanedBuildingBlocks
This package built for OIG-Saned
191
SanedBuildingBlocks
This package built for OIG-Saned
186
SanedBuildingBlocks
This package built for OIG-Saned
184
SanedBuildingBlocks
This package built for OIG-Saned
157
SanedBuildingBlocks
This package built for OIG-Saned
125
SanedBuildingBlocks
This package built for OIG-Saned
121
SanedBuildingBlocks
This package built for OIG-Saned
118
SanedBuildingBlocks
This package built for OIG-Saned
115
SanedBuildingBlocks
This package built for OIG-Saned
110

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 15 12/01/2024
7.0.0 14 06/26/2023
6.0.1 14 06/19/2023