Namh.Configuration.Template 1.0.1

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

TemplateConfig

TemplateConfig resolves {Path} references in .NET configuration values. Install the Namh.Configuration.Template package, register your usual providers, and call BuildTemplateConfig():

dotnet add package Namh.Configuration.Template --version 1.0.1
using Microsoft.Extensions.Configuration;

var configuration = new ConfigurationBuilder()
    .AddJsonFile("appsettings.json")
    .BuildTemplateConfig();

BuildTemplateConfig() returns an IConfigurationRoot, so existing configuration APIs such as indexers, GetSection(), GetChildren(), and Reload() continue to work while referenced values are resolved when read. The Get<T>() extension reads and binds a typed value from a configuration section.

Version 1.0.1 supports .NET 8, .NET 9, and .NET 10.

The examples below use appsettings.json.

Examples

1. Look up

References can point into parent and sibling fields recursively:

{
  "Primitive": "Pri",                                 // -> Result: "Pri"
  "Ref-Primitive1": "--{Primitive}--",                // -> Result: "--Pri--"
  "Ref-Primitive2": "{Primitive}.{Ref-Primitive1}",   // -> Result: "Pri.--Pri--"
  "Ref-Primitive-Loop": "--{{Primitive}mitive}--",    // -> Result: "--Pri--"

  "Array": [ "A", "B", "{Primitive}" ],               // -> Result: [ "A", "B", "Pri" ]
}
var value = configuration["Ref-Primitive-Loop"]       // -> Result: "--Pri--"

Use Get<T>() to bind a resolved value to a .NET type:

var values = configuration.Get<string[]>("Ref-Array");
// -> Result: [ "1", "2", "--Pri--" ]

Sections resolve referenced values through their indexer and child sections:

var field = configuration.GetSection("Root:Child")["Field2"];
// -> Result: "-F1:Pri-"

2. Escape a character

Use a backtick to keep braces literal:

{
  "Primitive": "Pri",
  "Escaped": "--`{Primitive`}--"
}

Escaped resolves to --{Primitive}--.

3. Error syntax

An unmatched brace throws InvalidOperationException when the value is read:

{
  "MissingClose": "--{Primitive--",
  "MissingOpen": "--Primitive}--"
}

Build and test

dotnet build src/Template.slnx
dotnet test src/Template.slnx
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  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 Namh.Configuration.Template:

Package Downloads
Namh.Configuration.GlobalTemplate

Integrates configuration templates with .NET generic hosts and ASP.NET Core applications, resolving references between values in Microsoft.Extensions.Configuration.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 106 11/3/2026
1.0.1 132 10/1/2026
1.0.0 106 9/30/2026