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,447
SanedBuildingBlocks
This package built for OIG-Saned
2,467
SanedBuildingBlocks
This package built for OIG-Saned
920
SanedBuildingBlocks
This package built for OIG-Saned
843
SanedBuildingBlocks
This package built for OIG-Saned
770
SanedBuildingBlocks
This package built for OIG-Saned
655
SanedBuildingBlocks
This package built for OIG-Saned
464
SanedBuildingBlocks
This package built for OIG-Saned
431
SanedBuildingBlocks
This package built for OIG-Saned
359
SanedBuildingBlocks
This package built for OIG-Saned
285
SanedBuildingBlocks
This package built for OIG-Saned
276
SanedBuildingBlocks
This package built for OIG-Saned
240
SanedBuildingBlocks
This package built for OIG-Saned
237
SanedBuildingBlocks
This package built for OIG-Saned
233
SanedBuildingBlocks
This package built for OIG-Saned
202
SanedBuildingBlocks
This package built for OIG-Saned
199
SanedBuildingBlocks
This package built for OIG-Saned
195
SanedBuildingBlocks
This package built for OIG-Saned
193
SanedBuildingBlocks
This package built for OIG-Saned
192
SanedBuildingBlocks
This package built for OIG-Saned
136

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