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,378
SanedBuildingBlocks
This package built for OIG-Saned
2,351
SanedBuildingBlocks
This package built for OIG-Saned
908
SanedBuildingBlocks
This package built for OIG-Saned
831
SanedBuildingBlocks
This package built for OIG-Saned
740
SanedBuildingBlocks
This package built for OIG-Saned
643
SanedBuildingBlocks
This package built for OIG-Saned
449
SanedBuildingBlocks
This package built for OIG-Saned
419
SanedBuildingBlocks
This package built for OIG-Saned
274
SanedBuildingBlocks
This package built for OIG-Saned
266
SanedBuildingBlocks
This package built for OIG-Saned
189
SanedBuildingBlocks
This package built for OIG-Saned
184
SanedBuildingBlocks
This package built for OIG-Saned
182
SanedBuildingBlocks
This package built for OIG-Saned
123
SanedBuildingBlocks
This package built for OIG-Saned
118
SanedBuildingBlocks
This package built for OIG-Saned
115
SanedBuildingBlocks
This package built for OIG-Saned
112
SanedBuildingBlocks
This package built for OIG-Saned
108
SanedBuildingBlocks
This package built for OIG-Saned
101
SanedBuildingBlocks
This package built for OIG-Saned
92

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