Conphig 2.0.1

.NET 6.0
dotnet add package Conphig --version 2.0.1
NuGet\Install-Package Conphig -Version 2.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="Conphig" Version="2.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Conphig --version 2.0.1
#r "nuget: Conphig, 2.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.
// Install Conphig as a Cake Addin
#addin nuget:?package=Conphig&version=2.0.1

// Install Conphig as a Cake Tool
#tool nuget:?package=Conphig&version=2.0.1


Conphig is a .NET 6 package for loading configuration from JSON files, command line and environment variables.

Getting started

After installing the Conphig package, create a simple POCO class and place your configuration items as properties inside.

For each property, use the JsonPropertyName, CommandLine, and EnvironmentVariable attributes to control how that property is deserialized from JSON files, command line parameters, and environment variables.

Then, in your Main method (or somewhere else that makes sense given your app startup code), add a call to Config.Load<T> to create and populate an object containing your configuration items.

Example configuration class

using System.Text.Json.Serialization;
using ATornblad.Conphig;

namespace MyApp
    public class Settings
        [CommandLine("-t", "--title")]
        public string Title { get; set; } = "Untitled";

        [CommandLine("-c", "--category")]
        public string[] Categories { get; set; }

        public string ApiKey { get; set; }

        [CommandLine("-v", "--verbose")]
        public bool VerboseOutput { get; set; }

Example of loading

using System;
using ATornblad.Conphig;
namespace MyApp
    public class Program
        public static void Main(string[] args)
            var settings = Config.Load<Settings>();
            if (settings.VerboseOutput)
                Console.WriteLine($"Title: {settings.Title}");

Example of configuration file

    "title": "Title from JSON file",
    "categories": [

Example of command line arguments

myapp --verbose -t "Title from Command Line" -c API -c Programming -c bash

Read more

For more information, visit the Project Website

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android 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. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

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
2.0.1 243 1/13/2023
2.0.0 228 1/12/2023
1.0.2 760 10/12/2021
1.0.1 617 10/6/2021
1.0.0 272 10/5/2021
0.9.3 280 10/1/2021
0.9.2 269 10/1/2021
0.9.1 324 9/30/2021
0.9.0 261 9/30/2021

v2.0.1 : Small performance improvement in array parsing, and code clean-up
v2.0.0 : DefaultAttribute made obsolete

v1.0.3 : Ported to .NET 6.0
v1.0.2 : Minor bug fixes
v1.0.1 : Minor bug fixes
v1.0.0 : First major release. DefaultAttribute is made obsolete.

v0.9.3 : Minor bug fixes
v0.9.2 : Added better package documentation
v0.9.1 : Added support for array properties
v0.9.0 : First release