Read YAML files in your .NET apps - super easy!
This library helps you read settings from YAML files in your .NET applications. YAML is like JSON but easier to read and write!
dotnet add package Kat.Configuration.Yaml1. Create a appsettings.yaml file:
App:
Name: MyAwesomeApp
Version: 1.0.0
Database:
Host: localhost
Port: 54322. Add it to your app:
using Microsoft.Extensions.Configuration;
var config = new ConfigurationBuilder()
.AddYamlFile("appsettings.yaml")
.Build();
// Read your settings
var appName = config["App:Name"]; // "MyAwesomeApp"
var dbHost = config["Database:Host"]; // "localhost"- ✅ Simple to use
- ✅ Works with .NET 5, 6, 7, 8, 9 and .NET Standard 2.0
Optional file (won't crash if missing):
.AddYamlFile("appsettings.yaml", optional: true)Reload when file changes:
.AddYamlFile("appsettings.yaml", optional: false, reloadOnChange: true)Read from a Stream:
using var stream = File.OpenRead("config.yaml");
.AddYamlStream(stream)Found a bug? Want to help? Pull requests are welcome!
Apache License 2.0
Made with ❤️ for the .NET community