Soenneker.Extensions.ConfigurationBuilder
11.0.421
Prefix Reserved
dotnet add package Soenneker.Extensions.ConfigurationBuilder --version 11.0.421
NuGet\Install-Package Soenneker.Extensions.ConfigurationBuilder -Version 11.0.421
<PackageReference Include="Soenneker.Extensions.ConfigurationBuilder" Version="11.0.421" />
<PackageVersion Include="Soenneker.Extensions.ConfigurationBuilder" Version="11.0.421" />
<PackageReference Include="Soenneker.Extensions.ConfigurationBuilder" />
paket add Soenneker.Extensions.ConfigurationBuilder --version 11.0.421
#r "nuget: Soenneker.Extensions.ConfigurationBuilder, 11.0.421"
#:package Soenneker.Extensions.ConfigurationBuilder@11.0.421
#addin nuget:?package=Soenneker.Extensions.ConfigurationBuilder&version=11.0.421
#tool nuget:?package=Soenneker.Extensions.ConfigurationBuilder&version=11.0.421
Soenneker.Extensions.ConfigurationBuilder
Adds predictable appsettings, Ocelot, and environment-variable sources to an IConfigurationBuilder.
Installation
dotnet add package Soenneker.Extensions.ConfigurationBuilder
Initialize a builder
using Soenneker.Extensions.ConfigurationBuilder;
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
builder.Configuration.Initialize(builder.Environment.EnvironmentName);
Initialize() deliberately rebuilds most of the source list. It:
- Keeps existing chained and command-line sources and removes all other sources.
- Adds one appsettings file for the supplied environment.
- Adds unprefixed environment variables last, so they override the retained sources and JSON values.
Call it before adding any custom configuration providers that must be retained. Command-line sources are preserved, but environment variables added by this method have higher precedence.
File selection
The recognized environments and selected files are:
| Environment | App settings | Ocelot |
|---|---|---|
Development |
appsettings.Development.json |
ocelot.Development.json |
Staging |
appsettings.Staging.json |
ocelot.Staging.json |
Production |
appsettings.Production.json |
ocelot.Production.json |
| Missing or any other value | appsettings.json |
ocelot.json |
Environment matching is case-insensitive, while generated filenames use the canonical casing shown above. Each method adds exactly one JSON file; it does not layer the base file beneath an environment-specific file.
JSON files are optional and do not reload by default. Override either behavior when adding a source directly:
builder.Configuration.AddAppSettings(
builder.Environment.EnvironmentName,
optional: false,
reloadOnChange: true);
builder.Configuration.AddOcelotConfig(
builder.Environment.EnvironmentName,
optional: false);
AddAppSettings() and AddOcelotConfig() append their JSON source without removing existing providers. Use those methods instead of Initialize() when you need to keep the builder's existing source collection.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Microsoft.Extensions.Configuration.CommandLine (>= 11.0.0)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 11.0.0)
- Microsoft.Extensions.Configuration.Json (>= 11.0.0)
- Soenneker.Enums.DeployEnvironment (>= 11.0.271)
- Soenneker.Extensions.Configuration (>= 11.0.921)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.421 | 124 | 12/3/2026 |
| 11.0.420 | 57 | 12/2/2026 |
| 11.0.419 | 49 | 12/2/2026 |
| 11.0.418 | 120 | 12/1/2026 |
| 11.0.417 | 93 | 12/1/2026 |
| 11.0.416 | 93 | 12/1/2026 |
| 11.0.415 | 105 | 11/30/2026 |
| 11.0.414 | 214 | 11/19/2026 |
| 11.0.413 | 96 | 11/18/2026 |
| 11.0.410 | 117 | 11/14/2026 |
| 11.0.409 | 191 | 11/11/2026 |
| 11.0.408 | 91 | 11/11/2026 |
| 11.0.407 | 103 | 11/11/2026 |
| 11.0.406 | 109 | 11/10/2026 |
| 11.0.403 | 66 | 11/10/2026 |
| 11.0.402 | 68 | 11/10/2026 |
| 11.0.401 | 64 | 11/10/2026 |
| 11.0.400 | 286 | 10/27/2026 |
| 11.0.399 | 84 | 10/26/2026 |
| 11.0.398 | 81 | 10/26/2026 |
Updated Soenneker.Enums.DeployEnvironment to 11.0.271