HostApplicationBuilderSettings.DisableDefaults Property

Definition

If false, configures the HostApplicationBuilder instance with pre-configured defaults. This has a similar effect to calling ConfigureDefaults(IHostBuilder, String[]).

public bool DisableDefaults { get; set; }

Property Value

false to configure the HostApplicationBuilder instance with preconfigured default settings; true to disable the use of default settings.

Remarks

The following defaults are applied to the IHostBuilder: * set the ContentRootPath to the result of GetCurrentDirectory() * load IConfiguration from "DOTNET_" prefixed environment variables * load IConfiguration from 'appsettings.json' and 'appsettings.[EnvironmentName].json' * load IConfiguration from User Secrets when EnvironmentName is 'Development' using the entry assembly * load IConfiguration from environment variables * load 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

Product Versions
.NET 6 (package-provided), 7 (package-provided), 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)