SharpConfig 4.0.0

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

<div class="title-block" style="text-align: center;" align="center">

SharpConfig

<p><img title="SharpConfig logo" src="logo.svg" width="130" height="130"></p>

Easy to use cfg / ini configuration library for .NET.

You can use SharpConfig to read, modify and save configuration files and streams, in either text or binary format.

Minimalistic, fully portable (.NET Standard 2.0), zero package dependencies.

Website NuGet Version NuGet Downloads .NET

</div>

Install

  • .NET CLI: > dotnet add package sharpconfig
  • Package Manager: > NuGet\Install-Package sharpconfig
  • Download latest

Example

# An example configuration:

[General]
# a comment
SomeString = Hello World!
SomeInteger = 10 # an inline comment
SomeFloat = 20.05
SomeBoolean = true
SomeArray = { 1, 2, 3 }
Day = Monday

[Person]
Name = Peter
Age = 50

To read these values, your C# code would look like:

var config = Configuration.LoadFromFile("sample.cfg");
var section = config["General"];

string    someString      = section["SomeString"].StringValue;
int       someInteger     = section["SomeInteger"].IntValue;
float     someFloat       = section["SomeFloat"].FloatValue;
bool      someBool        = section["SomeBoolean"].BoolValue;
int[]     someIntArray    = section["SomeArray"].IntValueArray;
string[]  someStringArray = section["SomeArray"].StringValueArray;
DayOfWeek day             = section["Day"].GetValue<DayOfWeek>();

// Entire user-defined objects can be created from sections and vice versa.
var person = config["Person"].ToObject<Person>();
// ...

Documentation

The full documentation is available on the website.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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-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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • net10.0

    • No dependencies.

NuGet packages (9)

Showing the top 5 NuGet packages that depend on SharpConfig:

Package Downloads
Chuma.AlphaMS.Aliyun

初码-AlphaMS开发库-阿里云库

Etor.Infrastructure

Package Description

Karpach.Remote.Commands.Base

Base class for Remote Controller commands (Karpach.Remote.Commander)

EasyLOB.Extensions.Ini

EasyLOB Extensions INI

SunamoIni

Work with .ini files used in Windows

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on SharpConfig:

Repository Stars
micahmo/WgServerforWindows
Wg Server for Windows (WS4W) is a desktop application that allows running and managing a WireGuard server endpoint on Windows
ciribob/DCS-SimpleRadioStandalone
An open source Stand alone Radio for DCS integrating with all clickable cockpits and FC3 Aircraft
Version Downloads Last Updated
4.0.0 83 1/23/2026
3.2.9.1 104,796 5/20/2020
3.2.9 2,070 5/19/2020
3.2.8 115,564 4/9/2018
3.2.6.1 3,384 3/8/2018
3.2.6 2,922 3/4/2018
3.2.5 3,051 12/12/2017
3.2.4 2,393 12/11/2017
3.2.3 2,349 12/7/2017
3.2.1 2,338 12/6/2017
3.2.0 3,613 7/7/2017
3.1.0 4,283 3/31/2017
3.0.1 3,410 12/5/2016
3.0.0 2,180 12/4/2016
2.1.0 6,202 11/7/2016
2.0.1 2,716 9/5/2016
2.0.0 3,470 8/21/2016
1.5.6 6,565 7/12/2016
1.5.5 4,876 6/1/2016
1.5.4 5,678 4/21/2016
1.5.3 2,249 4/11/2016
1.5.2 2,796 3/22/2016
1.5.1 2,208 3/4/2016
1.5.0 2,179 3/3/2016
1.4.9 11,644 12/16/2015
1.4.8 2,752 12/4/2015
1.4.7 2,488 11/30/2015
1.4.6 2,457 11/29/2015
1.4.4 2,797 8/28/2015
1.4.3 5,085 3/31/2015
1.4.2 2,504 1/31/2015
1.4.1 2,282 1/30/2015
1.4.0 3,218 9/26/2014
1.3.0 3,434 10/30/2013
1.2.0 2,483 10/29/2013

Major version 4.0.0 includes breaking changes:
- Nullable reference types enabled across the API.
- Deprecated StringRepresentation (use SaveToString).
- Removed legacy Setting.StringValueTrimmed.
- Optimized performance and added multiline value support.
For the full changelog, see the project URL.