Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/Base/KeyValueConfigBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,17 @@ protected string UpdateConfigSettingWithAppSettings(string configName)
});
}

// Try to use CurrentConfiguration before falling back to ConfigurationManager. Otherwise OpenConfiguration()
// scenarios won't work because we're looking in the wrong processes AppSettings.
else if (CurrentSection?.CurrentConfiguration?.AppSettings is AppSettingsSection currentAppSettings)
{
configValue = Regex.Replace(configValue, _tokenPattern, (m) =>
{
string settingName = m.Groups[1].Value;
return (currentAppSettings.Settings[settingName]?.Value ?? m.Groups[0].Value);
});
}

// All other config sections can just go through ConfigurationManager to get app settings though. :)
else
{
Expand Down