Interlook.Configuration 1.0.0

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

// Install Interlook.Configuration as a Cake Tool
#tool nuget:?package=Interlook.Configuration&version=1.0.0


Library for obtaining configuration data from different sources (currently INI-files and command line options) utilizing Microsoft.Extensions.Configuration.

May be combined with other existing extensions like Microsoft.Extensions.Configuration.NewtonsoftJson.


In the Microsoft.Extensions.Configuration world, actual configuration is generally stored as key/value-pairs. The key names are case insensitive and may pre prefixed with section names. Thus a key, say server_name may occur multiple times, eg. like this:

  • database:server_name
  • nuget_repo:server_name

The colon is used as key delimiter. Multiple prefixes are possible (like nuget_repo:primary:connection:server_name) but providers of this library don't make directly use of it, although you may define likewise.

Supported sources


The classic Ini-File format from old DOS times. There is a standard implementation in Microsoft.Extensions.Configuration.Ini, which doesn't completely deliver what I wanted.


Values are assigned to keys like this:

keyname=value that includes everything behind the equals sign
another="double quotes are possible and omitted in the value, if they are the first and last characters of the line"
imagine='same goes for single quotes'

Please note that multi-line values are not supported by the Ini-file format.


Comments are marked with # or ; at the beginning of the line

# Everything here is not parsed and just a comment
warning=Comments behind values are not possible, so     #this still belongs to the value

  # but you may indent comments, if you insist
colon="possible, and..."
;colon=seems to be used mostly to comment things out

Keys can be grouped into sections (as described above) like this:

# everything before the first section is not prefixed
global_key=has no prefix

# the following key name will be database:server_name

# you get the idea

#NOTE: sections cannot be nested, but again
#      if you insist, you could enforce it
# but this is against standard 
# and not guaranteed to work always, everywhere and forever

That's everything (actually a bit more) that is supported by Ini-files.

Command line arguments

Again, there is a standard implementation in Microsoft.Extensions.Configuration.CommandLine, but I wanted slightly more control and the opportunity to group short-switches, as known from the unix format.

Unlike with Ini-Files, you have to define the key-names (including possible [multi-]prefixes) in advance and map them to command line arguments.

Command line arguments can be divided into switches, valued options and values.


A switch is a single argument without a further value, mostly just enabling something (like a boolean value).

myTool --quiet
myTool -q

The above may be defined als aliases. For switches you define both key name and value in advance. This key/value pair is added to configuration, as soon as the corresponding switch is provided. Switches are always optional, since an mandatory switch would make no sense; what's the point of an argument, that always is to be specified for a program to work.

Valued options

There are arguments, which require an additional value to be provided. Consider this:

myTool --user MartinGalway
myTool -v 5

These arguments may be optional or required, just as you define it.

Here, you only define the key name in advance, since the actual value is obtained from command line. Omitting the value will cause an error.


Finally, the program may require certain values as input. We all know this:

copy -f source_file destination

Their order is fixed, the first argument, that is no switch and no value-option is interpreted as first value. For this you define a list of configuration key names, which determines the number and order of the required values.

Of course, all of the three types above can be mixed in any way.

myTool -q first_value --user Armakuni -nib second_value -f
myTool -nqib --user Armakuni -f first_value second_value
myTool --user Armakuni -fnqib first_value second_value
Short names

Short named options (switch or valued options) consist of only one single character and must be preceded by a single dash. They may be grouped and have no strict order, so the following syntaxes are (almost) equivalent:

myTool -q -i -n
myTool -qin
myTool -i -nq

An argument requiring an additional value can, of course, only be in a group, if it's the last character, like this:

myTool -q -i -n -v 5
myTool -qinv 5
Long names

Long names for arguments have to be prefixed with a double dash.

myTool --quiet
myTool --user MilkaCow
Order of options

The order of options (not required values) is generally not important. The only thing to consider is, that arguments are parsed in sequence, so if you define conflicting arguments, the last argument may be decisive. Consider:

myTool --verbose --quiet
myTool --quiet --verbose

Here, if quiet and verbose define opposing values for the same key, the first version will go with the quiet value while the latter will result the verbose one. The same applies for valued options:

myTool --user MelittaMan -u GerdFroebe
myTool -u GerdFroebe --user MelittaMan

The respective last value ist taken for the configuration key for user.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
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.0.0 358 3/30/2020