Configuration and configuration providers in .NET
Answer: Configuration in .NET is performed using one or more configuration providers. Given one or more configuration sources, the IConfiguration type provides a unified view of the configuration data. (S1)
Basics
- Configuration is read-only, and the configuration pattern isn't designed to be programmatically writable. (S1)
- .NET console apps created using the dotnet new command template or Visual Studio by default don't expose configuration capabilities. (S1)
- To add configuration in a new .NET console application, add a package reference to Microsoft.Extensions.Configuration. (S1)
Providers
- Several types of providers rely on various configuration sources. (S2)
- FileConfigurationProvider is the base class for loading configuration from the file system. (S2)
- The JsonConfigurationProvider class loads configuration from a JSON file. (S2)
- All of the file configuration providers throw the FormatException when duplicate keys are found in a single provider. (S2)
Claims
- id: C1 claim: Configuration uses providers. source: S1 evidence: "Configuration in .NET is performed using one or more configuration providers."
- id: C2 claim: Configuration is read-only. source: S1 evidence: "Configuration is read-only"
- id: C3 claim: JsonConfigurationProvider reads JSON. source: S2 evidence: "The JsonConfigurationProvider class loads configuration from a JSON file."
- id: C4 claim: Duplicate keys throw FormatException. source: S2 evidence: "When keys are found by multiple providers"
Sources
- [S1] Configuration - .NET. Microsoft Learn (.NET docs). https://learn.microsoft.com/en-us/dotnet/core/extensions/configuration . License: CC BY 4.0 (dotnet/docs). Accessed 2026-11-04.
- [S2] Configuration providers - .NET. Microsoft Learn (.NET docs). https://learn.microsoft.com/en-us/dotnet/core/extensions/configuration-providers . License: CC BY 4.0 (dotnet/docs). Accessed 2026-11-04.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Microsoft Learn (.NET docs), Configuration - .NET, CC BY 4.0 (dotnet/docs); Microsoft Learn (.NET docs), Configuration providers - .NET, CC BY 4.0 (dotnet/docs).
Cite this
iinventedlight. 2026. "Configuration and configuration providers in .NET." iinventedlight Library, iil:note:tme105k5, version of 2026-11-04. https://iinventedlight.com/library/notes/dotnet-configuration/. License: CC-BY-4.0.
@misc{iil_note_tme105k5,
author = {{iinventedlight}},
title = {{Configuration and configuration providers in .NET}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-04},
url = {https://iinventedlight.com/library/notes/dotnet-configuration/},
note = {Permanent ID iil:note:tme105k5. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.
For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/dotnet-configuration.md.