Curiosus.Configuration.YML 2.1.0

dotnet add package Curiosus.Configuration.YML --version 2.1.0
                    
NuGet\Install-Package Curiosus.Configuration.YML -Version 2.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Curiosus.Configuration.YML" Version="2.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Curiosus.Configuration.YML" Version="2.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Curiosus.Configuration.YML" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Curiosus.Configuration.YML --version 2.1.0
                    
#r "nuget: Curiosus.Configuration.YML, 2.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Curiosus.Configuration.YML@2.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Curiosus.Configuration.YML&version=2.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Curiosus.Configuration.YML&version=2.1.0
                    
Install as a Cake Tool

Curiosus.Configuration.YML

NuGet Downloads Coverage

YAML configuration provider: YamlConfigurationProvider<T> reads layered config*.yml files, environment variables and command line arguments and binds them to a POCO. Use it when the application is configured with YAML files instead of appsettings.json.

Installation

dotnet add package Curiosus.Configuration.YML

Usage

Files are looked up in the given directory (the current directory if null), in this order:

File Required Loaded when
config.yml yes (unless isConfigOptional: true) always
config.secret.yml no always
config.{env}.yml, config.{env}.secret.yml no ASPNETCORE_ENVIRONMENT is set and is not Production
config.{env}.{USER}.yml, config.{env}.{USER}.secret.yml no as above and USER is set

Environment variables and command line arguments are applied on top. Keep *.secret.yml out of source control.

# config.yml
ServiceUrl: https://example.com
Smtp:
  Host: smtp.example.com
  Port: 587
using Curiosus.Configuration;

var provider = new YamlConfigurationProvider<AppConfiguration>(configurationBasePath: null, cliArgs: args);
var configuration = provider.GetConfiguration(); // strongly typed, cached
var raw = provider.GetRawConfiguration();        // IConfiguration

// or plug the same sources into a host
var builder = WebApplication.CreateBuilder(args);
provider.ConfigureAppConfiguration(builder.Configuration);

public class AppConfiguration
{
    public string ServiceUrl { get; set; } = null!;
    public SmtpSection Smtp { get; set; } = new();
}

public class SmtpSection
{
    public string Host { get; set; } = null!;
    public int Port { get; set; }
}

Note: the provider lives in the Curiosus.Configuration namespace.

See also

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Curiosus.Configuration.YML:

Package Downloads
Curiosus.Hosting

Hosting tools

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.0 42 10/3/2026
2.0.0 63 9/28/2026