语言

HostApplicationBuilderSettings.DisableDefaults 属性

定义

获取或设置一个值,该值指示实例是否 HostApplicationBuilder 配置了预配置的默认值。

public:
 property bool DisableDefaults { bool get(); void set(bool value); };
public bool DisableDefaults { get; set; }
member this.DisableDefaults : bool with get, set
Public Property DisableDefaults As Boolean

属性值

如果实例配置了预配置的默认值,则为 。 这与调用 ConfigureDefaults(IHostBuilder, String[])的效果类似。

注解

以下默认值应用于 : * ContentRootPath 将 *从“DOTNET_”前缀环境变量 * 加载IConfigurationIConfiguration的结果GetCurrentDirectory()设置为 “appsettings.json” 和 'appsettings.[EnvironmentName].json' * 从用户机密加载时EnvironmentName,使用输入程序集 * IConfiguration 从环境变量IConfiguration加载 * 从提供的命令行参数加载 IConfiguration * 配置ILoggerFactoryIHostBuilder若要记录到控制台、调试和事件源输出 * ,则当“开发”时EnvironmentName,可以对依赖项注入容器启用范围验证

适用于