public static IConfigurationBuilder AddConfiguration(this IConfigurationBuilder config, string[] args, string variablePrefix = null) { // config.AddConfigFile("config"); config.AddConfigFile("config", false); if (args != null && args.Any()) { config.AddCommandLine(args); } if (string.IsNullOrWhiteSpace(variablePrefix)) { config.AddEnvironmentVariables(); } else { config.AddEnvironmentVariables(variablePrefix); } return(config); }
/// <summary> /// Adds configuration values for a *.config file to the ConfigurationBuilder /// </summary> /// <param name="builder">Builder to add configuration values to</param> /// <param name="path">Path to *.config file</param> public static IConfigurationBuilder AddConfigFile(this IConfigurationBuilder builder, string path) { return(builder.AddConfigFile(path, optional: false)); }
/// <summary> /// Adds configuration values for a *.config file to the ConfigurationBuilder /// </summary> /// <param name="builder">Builder to add configuration values to</param> /// <param name="path">Path to *.config file</param> public static IConfigurationBuilder AddConfigFile(this IConfigurationBuilder builder, string path, ILogger logger) { return(builder.AddConfigFile(path, false, logger)); }