Eigenverft.NetLib.Infrastructure 1.0.20264.50793-qa

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

🧱 Eigenverft.NetLib.Infrastructure

NuGet Version NuGet Downloads Targets License

Small, reusable infrastructure primitives for .NET applications and Generic Host-based services.

Provides predictable, executable-rooted application directories with automatic creation and writable validation.

Also includes Configuration Sets, SwitchableJson, configuration-value codecs and preparations, generic reversible string transforms, JSON-safe Base92 representation, machine binding, DPAPI machine-scope transforms, certificate primitives, configuration diagnostics, and pre-host bootstrap logging.


✨ At a glance

Package Eigenverft.NetLib.Infrastructure
Primary API HostApplicationBuilderFactory.CreateWithDefaultDirectory()
Root AppContext.BaseDirectory
Default folders AppLogs, AppData, AppState, AppProtectionKeys, AppCerts, AppSettings
Host integration Available before Build() and through DI afterwards
Target frameworks .NET 8 and .NET 10
License MIT

📦 Installation

dotnet add package Eigenverft.NetLib.Infrastructure

Or with the NuGet Package Manager:

Install-Package Eigenverft.NetLib.Infrastructure

🚀 Quick start

using Eigenverft.NetLib.Infrastructure.Hosting.DirectoryLayout;
using Microsoft.Extensions.Hosting;

var builder = HostApplicationBuilderFactory.CreateWithDefaultDirectory();
var directories = builder.GetDirectoryLayout();

string settingsDirectory =
    directories[DefaultDirectory.ApplicationSettings];

Console.WriteLine(settingsDirectory);

using IHost host = builder.Build();
await host.RunAsync();

The standard layout is created directly below the executable directory:

<application>/
├─ AppLogs/
├─ AppData/
├─ AppState/
├─ AppProtectionKeys/
├─ AppCerts/
└─ AppSettings/

Each directory is created during registration and checked for write access, so path or permission problems fail early during startup.

The same layout is registered as IAppDirectoryLayout after Build(), so normal constructor injection works as expected:

public sealed class Worker(
    ILogger<Worker> logger,
    IAppDirectoryLayout directories) : BackgroundService
{
    protected override async Task ExecuteAsync(CancellationToken stoppingToken)
    {
        logger.LogInformation(
            "Using application data directory {Directory}",
            directories[DefaultDirectory.ApplicationData]);

        await Task.Delay(Timeout.Infinite, stoppingToken);
    }
}

🗂️ Override standard folder names

builder.AddDefaultDirectoryLayout(
    new Dictionary<DefaultDirectory, string>
    {
        [DefaultDirectory.ApplicationData] = "Data",
        [DefaultDirectory.ApplicationLogFiles] = "Logs",
    });

Unspecified standard directories retain their defaults.

🧩 Custom directory layouts

builder.AddDirectoryLayout(
    new Dictionary<string, string>
    {
        ["Cache"] = "cache",
        ["Imports"] = "incoming",
    });

string imports = builder.GetDirectoryLayout()["Imports"];

Folder mappings are intentionally direct children of the application root. Rooted paths, nested paths, and traversal patterns are rejected.

🔧 Without Generic Host

AppDirectoryLayout directories = AppDirectoryLayoutFactory.CreateDefault();

An explicit root can also be supplied to the factory for tools, tests, or custom bootstrap scenarios.

Configuration preferred API

The public configuration surface is intentionally centered on developer-facing contracts and registration helpers:

  • builder.AddConfigurationSet(...) returns a ConfigurationSetRegistration for fluent startup binding. External runtime control uses IConfigurationSetManager.TrySwitchRuntime(...); set-specific control can use keyed IConfigurationSetCoordinator.TrySwitch(...).
  • builder.AddSwitchableJsonFile(...) registers a source; runtime control uses keyed ISwitchableJsonConfiguration.
  • IConfigurationSetCoordinator.BindSwitchableJson(...) is an advanced binding API for already existing runtimes and is supported only for coordinators created by NetLib configuration-set registration; it is not the runtime switch API.
  • SwitchableJsonRegistrationOptions.CandidatePreparation accepts IJsonConfigurationSourcePreparation; common preparations come from JsonConfigurationCandidatePreparations.
  • ConfigurationValueCodecs provides the built-in persisted codecs. External adapters can compose a public ReversibleStringTransform with new ConfigurationValueCodec(...) and then use JsonConfigurationCandidatePreparations.Decode(...).
  • ResetToMinimalConfigurationSources(...) and LogConfigurationResolution(...) are Generic Host configuration utilities and work through IHostApplicationBuilder.

Concrete coordinator, provider, runtime, pipeline, watcher, and persistence-format implementation types are intentionally internal. They are created and exposed through the public contracts above and are not required for normal consumer code.

Certificates

Eigenverft.NetLib.Infrastructure.Security.Certificates provides host-independent X.509 helpers:

  • SelfSignedCertificateFactory.Create(...) creates caller-owned self-signed certificates for TLS server/client, code-signing, and email-protection purposes using RSA or ECDSA profiles.
  • ManagedCertificateFile.LoadOrCreate(...) loads a managed PFX or returns a policy-controlled recovery certificate. CertificateRecoveryMode.PreserveExisting is the safe default and does not overwrite an existing unusable PFX.

The certificate APIs have no ASP.NET Core, Kestrel, SNI, configuration, or logging dependency.

🎯 Target frameworks

The package ships dedicated assets for:

  • net8.0
  • net10.0

A .NET 9 consumer can use the compatible net8.0 asset.

📄 License

Licensed under the MIT License by Eigenverft.


Made with ❤️ by Eigenverft

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 was computed.  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.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.20264.50793-qa 0 8/20/2026