HostApplicationBuilder Class

Definition

Represents a hosted applications and services builder that helps manage configuration, logging, lifetime, and more.

C#
public sealed class HostApplicationBuilder : Microsoft.Extensions.Hosting.IHostApplicationBuilder
Inheritance
HostApplicationBuilder
Implements

Constructors

HostApplicationBuilder()

Initializes a new instance of the HostApplicationBuilder class with preconfigured defaults.

HostApplicationBuilder(HostApplicationBuilderSettings)

Initializes a new instance of the HostApplicationBuilder.

HostApplicationBuilder(String[])

Initializes a new instance of the HostApplicationBuilder class with preconfigured defaults.

Properties

Configuration

Gets the set of key/value configuration properties.

Environment

Gets information about the hosting environment an application is running in.

Logging

Gets a collection of logging providers for the application to compose. This property is useful for adding new logging providers.

Metrics

Allows enabling metrics and directing their output.

Services

Gets a collection of services for the application to compose. This property is useful for adding user-provided or framework-provided services.

Methods

Explicit Interface Implementations

IHostApplicationBuilder.Configuration

Gets the set of key/value configuration properties.

IHostApplicationBuilder.Properties

Gets a central location for sharing state between components during the host building process.

Applies to

Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)