SynesthesiaDev.ConfigLib 2026.902.0

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

⚙️ ConfigLib

GitHub Workflow Status NuGet Version

Target .NET License

Config utility library so I don't have to copy and paste code in all of my projects.

How to use

Create a config record with Codon codec and extend IConfigModel interface

public record Config(string Name, string Ip, int Port) : IConfigModel
{
    public static readonly Config DEFAULT = new Config("test", "0.0.0.0", 27533);

    public static readonly Codec<Config> CODEC = StructCodec .For<Config>()
        .Field("Name", Codecs.STRING, c => c.Name)
        .Field("Ip", Codecs.STRING, c => c.Ip)
        .Field("Port", Codecs.INT, c => c.Port)
        .Build((name, ip, port) => new Config(name, ip, port));
}

Create the ConfigLib instance. Here you can specify stuff like location, the codec and the transcoder (config language) you want to use, along with default value

public static readonly ConfigLib<Config, ISynxElement> CONFIG = ConfigLib.For<Config, ISynxElement>()
    .Encoding(Config.CODEC, SynxTranscoder.INSTANCE)
    .Location(ConfigLocation.DataFolder("config.synx"))
    .Default(Config.DEFAULT)
    .Build();

You can additionally add hooks like DirectoryCreatedHook to for example copy additional default files:

.DirectoryCreateHook(location =>
{
    Utils.CopyEmbeddedFolder(GetType().Assembly, "Canopy.Core.Resources", location.FolderPath);
})

You can also add simple validation

.Validation(config =>
{
    if (config.Port == 25565) return "This port is taken by minecraft..";
    return null;
})

Then whenever you want your config loaded, you call Load and access it with CONFIG.Current:

private static void Main(string[] args)
{
    CONFIG.Load();
}

You can also set CONFIG.Current to a new value and the file will be automatically saved


【= ❙ 𖥦 ❙ =】

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.

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
2026.902.0 22 9/2/2026