Microsoft.Extensions.Configuration 9.0.0-rc.2.24473.5
About
Microsoft.Extensions.Configuration
is combined with a core configuration abstraction under Microsoft.Extensions.Configuration.Abstractions
that allows for building different kinds of configuration providers to retrieve key/value pair configuration values from in the form of IConfiguration
. There are a number of built-in configuration provider implementations to read from environment variables, in-memory collections, JSON, INI or XML files. Aside from the built-in variations, there are more shipped libraries shipped by community for integration with various configuration service and other data sources.
Key Features
- In-memory configuration provider
- Chained configuration provider for chaining multiple confiugration providers together.
- Base types that implement configuration abstraction interfaces that can be used when implementing other configuration providers.
How to Use
using Microsoft.Extensions.Configuration;
var configurationBuilder = new ConfigurationBuilder();
configurationBuilder.AddInMemoryCollection(
new Dictionary<string, string?>
{
["Setting1"] = "value",
["MyOptions:Enabled"] = bool.TrueString,
});
configurationBuilder.AddInMemoryCollection(
new Dictionary<string, string?>
{
["Setting2"] = "value2",
["MyOptions:Enabled"] = bool.FalseString,
});
var config = configurationBuilder.Build();
// note case-insensitive
Console.WriteLine(config["setting1"]);
Console.WriteLine(config["setting2"]);
// note last in wins
Console.WriteLine(config["MyOptions:Enabled"]);
Main Types
The main types provided by this library are:
Microsoft.Extensions.Configuration.ConfigurationBuilder
Microsoft.Extensions.Configuration.ConfigurationManager
Microsoft.Extensions.Configuration.ConfigurationRoot
Microsoft.Extensions.Configuration.ConfigurationSection
Additional Documentation
Related Packages
- Microsoft.Extensions.Configuration.Binder
- Microsoft.Extensions.Configuration.CommandLine
- Microsoft.Extensions.Configuration.EnvironmentVariables
- Microsoft.Extensions.Configuration.FileExtensions
- Microsoft.Extensions.Configuration.Ini
- Microsoft.Extensions.Configuration.Json
- Microsoft.Extensions.Configuration.UserSecrets
- Microsoft.Extensions.Configuration.Xml
Feedback & Contributing
Microsoft.Extensions.Configuration is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
Showing the top 20 packages that depend on Microsoft.Extensions.Configuration.
Packages | Downloads |
---|---|
Microsoft.Extensions.Configuration.CommandLine
Command line configuration provider implementation for Microsoft.Extensions.Configuration. This package enables you to read configuration parameters from the command line arguments of your application. You can use CommandLineConfigurationExtensions.AddCommandLine extension method on IConfigurationBuilder to add the command line configuration provider to the configuration builder.
|
1,307 |
Microsoft.Extensions.Configuration.EnvironmentVariables
Environment variables configuration provider implementation for Microsoft.Extensions.Configuration. This package enables you to read configuration parameters from environment variables. You can use EnvironmentVariablesExtensions.AddEnvironmentVariables extension method on IConfigurationBuilder to add the environment variables configuration provider to the configuration builder.
|
1,301 |
Microsoft.Extensions.Diagnostics
This package includes the default implementation of IMeterFactory and additional extension methods to easily register it with the Dependency Injection framework.
|
1,022 |
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
|
935 |
Microsoft.Extensions.Configuration.FileExtensions
Provides a base class for file-based configuration providers used with Microsoft.Extensions.Configuration and extension methods for configuring them.
|
910 |
Microsoft.Extensions.Logging.Configuration
Configuration support for Microsoft.Extensions.Logging.
|
906 |
Microsoft.Extensions.Configuration.Json
JSON configuration provider implementation for Microsoft.Extensions.Configuration. This package enables you to read your application's settings from a JSON file. You can use JsonConfigurationExtensions.AddJsonFile extension method on IConfigurationBuilder to add the JSON configuration provider to the configuration builder.
|
902 |
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
|
421 |
Microsoft.Extensions.Configuration.FileExtensions
Provides a base class for file-based configuration providers used with Microsoft.Extensions.Configuration and extension methods for configuring them.
|
414 |
Microsoft.Extensions.Diagnostics
This package includes the default implementation of IMeterFactory and additional extension methods to easily register it with the Dependency Injection framework.
|
414 |
Microsoft.Extensions.Configuration.Json
JSON configuration provider implementation for Microsoft.Extensions.Configuration. This package enables you to read your application's settings from a JSON file. You can use JsonConfigurationExtensions.AddJsonFile extension method on IConfigurationBuilder to add the JSON configuration provider to the configuration builder.
|
413 |
Microsoft.Extensions.Logging.Configuration
Configuration support for Microsoft.Extensions.Logging.
|
403 |
Microsoft.Extensions.Configuration.Binder
Functionality to bind an object to data in configuration providers for Microsoft.Extensions.Configuration.
|
340 |
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
|
208 |
Microsoft.Extensions.Logging.Configuration
Configuration support for Microsoft.Extensions.Logging.
|
204 |
Microsoft.Extensions.Configuration.CommandLine
Command line configuration provider implementation for Microsoft.Extensions.Configuration.
|
203 |
Microsoft.Extensions.Configuration.EnvironmentVariables
Environment variables configuration provider implementation for Microsoft.Extensions.Configuration.
|
203 |
Microsoft.Extensions.Configuration.Json
JSON configuration provider implementation for Microsoft.Extensions.Configuration.
|
202 |
Microsoft.Extensions.Configuration.FileExtensions
Extension methods for configuring file-based configuration providers for Microsoft.Extensions.Configuration.
|
200 |
Microsoft.AspNetCore.Hosting
ASP.NET Core hosting infrastructure and startup logic for web applications.
This package was built from the source code at https://github.com/aspnet/AspNetCore/tree/be0a4a7f4cf06cbd6ec714bd1d9afee6bdb040a8
|
15 |
.NET Framework 4.6.2
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0-rc.2.24473.5)
- Microsoft.Extensions.Primitives (>= 9.0.0-rc.2.24473.5)
.NET 8.0
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0-rc.2.24473.5)
- Microsoft.Extensions.Primitives (>= 9.0.0-rc.2.24473.5)
.NET 9.0
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0-rc.2.24473.5)
- Microsoft.Extensions.Primitives (>= 9.0.0-rc.2.24473.5)
.NET Standard 2.0
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0-rc.2.24473.5)
- Microsoft.Extensions.Primitives (>= 9.0.0-rc.2.24473.5)