Eigenverft.NetLib.Infrastructure
1.0.20264.50793-qa
dotnet add package Eigenverft.NetLib.Infrastructure --version 1.0.20264.50793-qa
NuGet\Install-Package Eigenverft.NetLib.Infrastructure -Version 1.0.20264.50793-qa
<PackageReference Include="Eigenverft.NetLib.Infrastructure" Version="1.0.20264.50793-qa" />
<PackageVersion Include="Eigenverft.NetLib.Infrastructure" Version="1.0.20264.50793-qa" />
<PackageReference Include="Eigenverft.NetLib.Infrastructure" />
paket add Eigenverft.NetLib.Infrastructure --version 1.0.20264.50793-qa
#r "nuget: Eigenverft.NetLib.Infrastructure, 1.0.20264.50793-qa"
#:package Eigenverft.NetLib.Infrastructure@1.0.20264.50793-qa
#addin nuget:?package=Eigenverft.NetLib.Infrastructure&version=1.0.20264.50793-qa&prerelease
#tool nuget:?package=Eigenverft.NetLib.Infrastructure&version=1.0.20264.50793-qa&prerelease
🧱 Eigenverft.NetLib.Infrastructure
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 aConfigurationSetRegistrationfor fluent startup binding. External runtime control usesIConfigurationSetManager.TrySwitchRuntime(...); set-specific control can use keyedIConfigurationSetCoordinator.TrySwitch(...).builder.AddSwitchableJsonFile(...)registers a source; runtime control uses keyedISwitchableJsonConfiguration.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.CandidatePreparationacceptsIJsonConfigurationSourcePreparation; common preparations come fromJsonConfigurationCandidatePreparations.ConfigurationValueCodecsprovides the built-in persisted codecs. External adapters can compose a publicReversibleStringTransformwithnew ConfigurationValueCodec(...)and then useJsonConfigurationCandidatePreparations.Decode(...).ResetToMinimalConfigurationSources(...)andLogConfigurationResolution(...)are Generic Host configuration utilities and work throughIHostApplicationBuilder.
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.PreserveExistingis 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.0net10.0
A .NET 9 consumer can use the compatible net8.0 asset.
🔗 Project links
📄 License
Licensed under the MIT License by Eigenverft.
Made with ❤️ by Eigenverft
| Product | Versions 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. |
-
net10.0
- Microsoft.Extensions.Hosting (>= 10.0.0)
-
net8.0
- Microsoft.Extensions.Hosting (>= 8.0.1)
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 |