Delen via


HostingHostBuilderExtensions.ConfigureDefaults(IHostBuilder, String[]) Method

Definition

Configures an existing IHostBuilder instance with pre-configured defaults. This will overwrite previously configured values and is intended to be called before additional configuration calls.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::Hosting::IHostBuilder ^ ConfigureDefaults(Microsoft::Extensions::Hosting::IHostBuilder ^ builder, cli::array <System::String ^> ^ args);
public static Microsoft.Extensions.Hosting.IHostBuilder ConfigureDefaults (this Microsoft.Extensions.Hosting.IHostBuilder builder, string[]? args);
static member ConfigureDefaults : Microsoft.Extensions.Hosting.IHostBuilder * string[] -> Microsoft.Extensions.Hosting.IHostBuilder
<Extension()>
Public Function ConfigureDefaults (builder As IHostBuilder, args As String()) As IHostBuilder

Parameters

builder
IHostBuilder

The existing builder to configure.

args
String[]

The command line args.

Returns

The same instance of the IHostBuilder for chaining.

Remarks

The following defaults are applied to the IHostBuilder: * set the ContentRootPath to the result of GetCurrentDirectory() * load host IConfiguration from "DOTNET_" prefixed environment variables * load host IConfiguration from supplied command line args * load app IConfiguration from 'appsettings.json' and 'appsettings.[EnvironmentName].json' * load app IConfiguration from User Secrets when EnvironmentName is 'Development' using the entry assembly * load app IConfiguration from environment variables * load app IConfiguration from supplied command line args * configure the ILoggerFactory to log to the console, debug, and event source output * enables scope validation on the dependency injection container when EnvironmentName is 'Development'

Applies to