<PackageReference Include="Microsoft.Extensions.Hosting" Version="11.0.0" />

Microsoft.Extensions.Hosting.HostBuilder

public class HostBuilder : IHostBuilder
A program initialization utility.
public IDictionary<object, object> Properties { get; }

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

public HostBuilder()

Initializes a new instance of HostBuilder.

public IHost Build()

Run the given actions to initialize the host. This can only be called once.

public IHostBuilder ConfigureAppConfiguration(Action<HostBuilderContext, IConfigurationBuilder> configureDelegate)

Sets up the configuration for the remainder of the build process and application. This can be called multiple times and the results will be additive. The results will be available at Configuration for subsequent operations, as well as in Services.

public IHostBuilder ConfigureContainer<TContainerBuilder>(Action<HostBuilderContext, TContainerBuilder> configureDelegate)

Enables configuring the instantiated dependency container. This can be called multiple times and the results will be additive.

public IHostBuilder ConfigureHostConfiguration(Action<IConfigurationBuilder> configureDelegate)

Set up the configuration for the builder itself. This will be used to initialize the IHostEnvironment for use later in the build process. This can be called multiple times and the results will be additive.

public IHostBuilder ConfigureServices(Action<HostBuilderContext, IServiceCollection> configureDelegate)

Adds services to the container. This can be called multiple times and the results will be additive.

public IHostBuilder UseServiceProviderFactory<TContainerBuilder>(IServiceProviderFactory<TContainerBuilder> factory)

Overrides the factory used to create the service provider.

public IHostBuilder UseServiceProviderFactory<TContainerBuilder>(Func<HostBuilderContext, IServiceProviderFactory<TContainerBuilder>> factory)

Overrides the factory used to create the service provider.