Sportronics.ConfigurationManager 1.0.3

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

Sportronics.ConfigurationManager

A flexible configuration management library for .NET applications that handles settings from JSON files and command line arguments.

Features

  • Load configuration from JSON files
  • Parse and apply command line arguments
  • Combine multiple configuration sources with priority order
  • Save configuration changes back to JSON files
  • Support for both long and short command line argument formats

Installation

dotnet add package Sportronics.ConfigurationManager

Usage

1. Create a settings class

using Sportronics.ConfigurationManager;

public class MyAppSettings : AppSettingsBase
{
    public override string SectionName => "MyApp";
    
    public string InputFolder { get; set; } = "default/input";
    public string OutputFolder { get; set; } = "default/output";
    public bool VerboseLogging { get; set; } = false;
    
    public override string ToString()
    {
        return $"InputFolder: {InputFolder}, OutputFolder: {OutputFolder}, VerboseLogging: {VerboseLogging}";
    }
}

2. Define command line options

var optionsMap = new Dictionary<string, (string LongName, string ShortName)>
{
    { nameof(MyAppSettings.InputFolder), ("input", "i") },
    { nameof(MyAppSettings.OutputFolder), ("output", "o") },
    { nameof(MyAppSettings.VerboseLogging), ("verbose", "v") }
};

3. Process configuration

// Initialize the configuration processor
var configProcessor = new ConfigurationProcessor<MyAppSettings>(
    "appsettings.json", 
    optionsMap);

// Process configuration from all sources
var settings = configProcessor.ProcessConfiguration(args);

// Use the settings
Console.WriteLine($"Using settings: {settings}");

License

This project is licensed under the MIT License - see the LICENSE file for details.

Release Notes

v1.0.2 (August 2025)

  • Renamed project from ConfigurationManager to Sportronics.ConfigurationManager
  • Improved namespace organization
  • Added support for both long and short form command line arguments
  • Fixed bug in configuration saving

v1.0.1

  • Initial public release
  • Basic configuration management functionality
  • Support for JSON files and command line arguments
Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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
1.1.5 210 8/6/2025
1.1.4 205 8/6/2025
1.1.3 207 8/6/2025
1.1.2 209 8/6/2025
1.1.1 207 8/6/2025
1.1.0 204 8/6/2025
1.0.3 201 8/5/2025
1.0.2 196 8/5/2025

v1.0.3 - Added project icon