dotnet add package Microsoft.Configuration.ConfigurationBuilders.Base --version 3.0.0
NuGet\Install-Package Microsoft.Configuration.ConfigurationBuilders.Base -Version 3.0.0
<PackageReference Include="Microsoft.Configuration.ConfigurationBuilders.Base" Version="3.0.0" />
paket add Microsoft.Configuration.ConfigurationBuilders.Base --version 3.0.0
#r "nuget: Microsoft.Configuration.ConfigurationBuilders.Base, 3.0.0"
// Install Microsoft.Configuration.ConfigurationBuilders.Base as a Cake Addin
// Install Microsoft.Configuration.ConfigurationBuilders.Base as a Cake Tool
Microsoft Key/Value Configuration Builders
ConfigurationBuilders are a feature of the full .Net Framework that were introduced in .Net 4.7.1. You can read about the concept in this blog post. While the ability to inject configuration at runtime now exists in .Net as of 4.7.1 with the
ConfiguraitonBuilder feature, the framework itself does not ship with any pre-made builders in box.
The goal of this project is for Microsoft to provide a basic set of Configuration Builders that should make it easy for developers to leverage this feature in their apps. They are intended to address some of the basic dynamic/non-local configuration needs of applications as they move into a container and cloud focused environment.
The set of builders produced here are styled as "Key/Value Config Builders." The architecture of
ConfigurationBuilder in the framework is actually quite flexible and can be leveraged to handle a great number of unique situations. To keep things as easy and as broadly applicable as possible though, this project focuses on simple key/value scenarios.
For more information about the builders featured in this project, to report bugs, or submit contributions, please refer to the github project page for MicrosoftConfigurationBuilders.
- ⚠️ Breaking Change -
Expandmode is gone. It has been replaced by
Utils.MapPath- This was somewhat broken in ASP.Net scenarios previously. It should now reliably go against
Server.MapPath()in ASP.Net scenarios. It has also been updated to fall back against the directory of the config file being processed when resolving the app root in the case of a
Configurationobject being created by
ConfigurationManager.OpenConfiguration*API's rather than being part of a fully-initialized runtime configuration stack.
- Json use has migrated to use
- The Azure Config Builders have been updated to require a newer minimum version of
Azure.Identityby default which allows for more methods of connecting to Azure, such as User-Assigned Managed Identity, or Client Certificate-based via environment variables. Also a pair of overloads (
GetSecretClientOptions/GetConfigurationClientOptions) have been added for users who need something more than
DefaultAzureCredentialwith default client options can provide.
- Added RecursionGuard to help detect and prevent situations where a
ConfigurationBuilderaccessing values from a
ConfigurationSectionother than the one which it is currently processing could result in stack overflow.
optionalattribute is obsolete ⇒
enabledattribute which provides more versatility. (The
optionalattribute is still parsed and recognized in the absence of the newer
enabledattribute, but builders should migrate to use the new attribute name when possible. Installation scripts should try to handle this automatically.)
- Character Mapping - Some config builders have had an internal mapping of characters that might exist in keys in the config file but are illegal in keys at the source. As more scenarios come to light and individual prefrences are not always unanimous, V3 instead adds the
charMapattribute to allow this character mapping to work with all KeyValueConfigBuilders and to be handled in an easily configurable manner.
ConnectionStringsSectionHandler2- A new section handler for the
<connectionStrings>section has been included in the base package. This new handler will allow updating of both the 'connectionString' attribute as well as the 'providerName' attribute. It does require the builders and source of config data to be aware of this new ability though. The default section handler for the
<connectionStrings>section has not been updated and remains as it was in previous versions, so apps wishing to take advantage of the new handler will have to wire it up in their config. More details can be found in the SectionHandlers documentation.
AzureAppConfigurationnuget package version is revved to match the rest of this suite of builders, rather than being 1 major version behind. (ie,
AzureAppConfiguration:3.0now depends on
- Azure App Configuration Support - There is a new builder for drawing values from the new Azure App Configuration service.
- ConfigBuilder Parameters from AppSettings - This has been one of the most asked for features of these config builders. With V2, it is now possible to read initialization parameters for config builders from
appSettings. Read more about it here.
- Lazy Initialization - As part of the work to enable pulling config parameters from
appSettings, these key/value configuration builders now support a lazy initialization model. Things that must happen immediately can be left in the existing
Initialize(name, config)method, or builders can leverage the new
LazyInitialize(name, config)method for things that can happen just before retrieving values. All builders in this project have been updated to be lazy whenever possible.
- Updateable Keys - Builders can now massage key names before inserting into config. The AzureKeyVaultConfigBuilder has been updated to use this feature to allow embedding 'version' tags in key names instead of applying a single 'version' tag to the builder. (Note: This is seperate from, and performed after prefix stripping.)
- [[Obsolete]] This has been superceded by the enabled tag. (
Base Optional Tag - The)
optionaltag that some of the builders in this project employed in V1 has been moved into the base class and is now available on all key/value config builders.
- Escaping Expanded Values - It is possible to xml-escape inserted values in
Token(as of V3) mode now using the new escapeExpandedValues attribute.
- Section Handlers - This feature allows users to develop extensions that will apply key/value config to sections other than
connectionStringsif desired. Read more about this feature in the Section Handlers segment below.
|Versions Compatible and additional computed target framework versions.
|net471 is compatible. net472 was computed. net48 was computed. net481 was computed.
This package has no dependencies.
NuGet packages (16)
Showing the top 5 NuGet packages that depend on Microsoft.Configuration.ConfigurationBuilders.Base:
A basic key/value Configuration Builder for the .Net Framework that draws from environment variables.
A basic key/value Configuration Builder for the .Net Framework that draws from a a 'secrets' file outside of source control.
A set of Configuration Builders for the .Net Framework that draw from Azure resources.
A set of Configuration Builders for the .Net Framework that draw from Azure AppConfiguration stores.
A basic key/value Configuration Builder for the .Net Framework that draws from a json file.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Microsoft.Configuration.ConfigurationBuilders.Base:
This nacos csharp sdk