ConfigHotReloadEngine 1.0.1

dotnet add package ConfigHotReloadEngine --version 1.0.1
                    
NuGet\Install-Package ConfigHotReloadEngine -Version 1.0.1
                    
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="ConfigHotReloadEngine" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ConfigHotReloadEngine" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="ConfigHotReloadEngine" />
                    
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 ConfigHotReloadEngine --version 1.0.1
                    
#r "nuget: ConfigHotReloadEngine, 1.0.1"
                    
#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 ConfigHotReloadEngine@1.0.1
                    
#: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=ConfigHotReloadEngine&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=ConfigHotReloadEngine&version=1.0.1
                    
Install as a Cake Tool

.NET Configuration Hot Reload Engine

A pure .NET, single-node configuration management component that supports safe runtime configuration reloading without application restarts.

This project focuses on correctness, thread safety, and clean design rather than infrastructure or UI concerns.


What Problem This Solves

Most applications load configuration once at startup. Any change requires a full restart, which is not always desirable.

This project provides a simple mechanism to:

  • Load strongly typed configuration from JSON
  • Keep configuration immutable and safe in memory
  • Detect file changes at runtime
  • Reload configuration atomically
  • Notify consumers when configuration changes

All within a single .NET process, without external dependencies.


Core Concepts

The system revolves around a single idea: there is always exactly one valid configuration instance in memory.

Configuration updates are applied atomically: either the new configuration is fully valid and replaces the old one, or the old configuration remains active.

Consumers never see partial or invalid state.


Features

  • Strongly typed configuration loading
  • File-based configuration source (JSON)
  • Automatic hot reload on file changes
  • Thread-safe access to configuration
  • Atomic config replacement
  • Change notification for subscribers
  • Graceful handling of invalid configuration files

Example Usage

  1. dotnet add package ConfigHotReloadEngine

  2. Create an AppConfig.json in the root of your project.

// See https://aka.ms/new-console-template for more information
using ConfigHotReloadEngine;

var provider = new ConfigurationProvider("./AppConfig.json");

provider.OnChange(config =>
{
    foreach (var kvp in config.AsObject())
    {
        Console.WriteLine($"{kvp.Key}: {kvp.Value}");
    }
    Console.WriteLine("---- Configuration Reloaded ----");
});

// Print initial config
// Print initial config
foreach (var kvp in provider.Current.AsObject())
{
    Console.WriteLine($"{kvp.Key}: {kvp.Value}");
}

await Process.Start();

ASP.NET Core example

Even though ASP.NET Core has IConfiguration and reloadOnChange: true for appsettings.json, it implements its own watcher internally.

Why? Because:

  • They don’t want to restart the app
  • They want thread-safe, in-memory updates
  • They notify parts of the app (like DI services) when config changes

This ConfigurationProvider is essentially a simplified, custom version of that mechanism.

Product Compatible and additional computed target framework versions.
.NET 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.
  • net10.0

    • No dependencies.

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
1.0.1 191 12/24/2025
1.0.0 192 12/24/2025