System.Configuration.ConfigurationManager
10.0.0-preview.5.25277.101
See the version list below for details.
dotnet add package System.Configuration.ConfigurationManager --version 10.0.0-preview.5.25277.101
NuGet\Install-Package System.Configuration.ConfigurationManager -Version 10.0.0-preview.5.25277.101
<PackageReference Include="System.Configuration.ConfigurationManager" Version="10.0.0-preview.5.25277.101" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="10.0.0-preview.5.25277.101" />
<PackageReference Include="System.Configuration.ConfigurationManager" />
paket add System.Configuration.ConfigurationManager --version 10.0.0-preview.5.25277.101
#r "nuget: System.Configuration.ConfigurationManager, 10.0.0-preview.5.25277.101"
#addin nuget:?package=System.Configuration.ConfigurationManager&version=10.0.0-preview.5.25277.101&prerelease
#tool nuget:?package=System.Configuration.ConfigurationManager&version=10.0.0-preview.5.25277.101&prerelease
About
Provides types that support using XML configuration files (app.config
). This package exists only to support migrating existing .NET Framework code that already uses System.Configuration. When writing new code, use another configuration system instead, such as Microsoft.Extensions.Configuration.
How to Use
The following example shows how to read and modify the application configuration settings.
using System;
using System.Configuration;
class Program
{
static void Main()
{
try
{
// Open current application configuration
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
KeyValueConfigurationCollection section = config.AppSettings.Settings;
// Print settings from configuration file
foreach (string key in section.AllKeys)
{
Console.WriteLine($"{key}: {section[key].Value}");
}
// Add new setting
section.Add("Database", "TestDatabase");
// Change existing setting
section["Username"].Value = "TestUser";
// Save changes to file
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection(config.AppSettings.SectionInformation.Name);
}
catch (ConfigurationErrorsException ex)
{
Console.WriteLine("Error reading configuration: ");
Console.WriteLine(ex.Message);
}
}
}
To run this example, include an app.config
file with the following content in your project:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Server" value="example.com"/>
<add key="Username" value="Admin"/>
</appSettings>
</configuration>
Main Types
The main types provided by this library are:
System.Configuration.Configuration
System.Configuration.ConfigurationManager
Additional Documentation
- Configure apps by using configuration files
- System.Configuration namespace
- System.Configuration.Configuration
- System.Configuration.ConfigurationManager
Feedback & Contributing
System.Configuration.ConfigurationManager is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
Product | Versions 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 is compatible. 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 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 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 is compatible. 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. |
-
.NETFramework 4.6.2
- No dependencies.
-
.NETStandard 2.0
- System.Security.Cryptography.ProtectedData (>= 10.0.0-preview.5.25277.101)
-
net10.0
- System.Diagnostics.EventLog (>= 10.0.0-preview.5.25277.101)
- System.Security.Cryptography.ProtectedData (>= 10.0.0-preview.5.25277.101)
-
net8.0
- System.Diagnostics.EventLog (>= 10.0.0-preview.5.25277.101)
- System.Security.Cryptography.ProtectedData (>= 10.0.0-preview.5.25277.101)
-
net9.0
- System.Diagnostics.EventLog (>= 10.0.0-preview.5.25277.101)
- System.Security.Cryptography.ProtectedData (>= 10.0.0-preview.5.25277.101)
GitHub repositories (292)
Showing the top 20 popular GitHub repositories that depend on System.Configuration.ConfigurationManager:
Repository | Stars |
---|---|
microsoft/PowerToys
Windows system utilities to maximize productivity
|
|
PowerShell/PowerShell
PowerShell for every system!
|
|
dotnet/roslyn
The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
|
|
jasontaylordev/CleanArchitecture
Clean Architecture Solution Template for ASP.NET Core
|
|
aspnetboilerplate/aspnetboilerplate
ASP.NET Boilerplate - Web Application Framework
|
|
Sonarr/Sonarr
Smart PVR for newsgroup and bittorrent users.
|
|
Radarr/Radarr
Movie organizer/manager for usenet and torrent users.
|
|
dotnet/BenchmarkDotNet
Powerful .NET library for benchmarking
|
|
mRemoteNG/mRemoteNG
mRemoteNG is the next generation of mRemote, open source, tabbed, multi-protocol, remote connections manager.
|
|
nopSolutions/nopCommerce
ASP.NET Core eCommerce software. nopCommerce is a free and open-source shopping cart.
|
|
MahApps/MahApps.Metro
A framework that allows developers to cobble together a better UI for their own WPF applications with minimal effort.
|
|
dotnet/machinelearning
ML.NET is an open source and cross-platform machine learning framework for .NET.
|
|
XINCGer/Unity3DTraining
【Unity杂货铺】unity大杂烩~
|
|
microsoft/ailab
Experience, Learn and Code the latest breakthrough innovations with Microsoft AI
|
|
dotnet/wpf
WPF is a .NET Core UI framework for building Windows desktop applications.
|
|
nissl-lab/npoi
a .NET library that can read/write Office formats without Microsoft Office installed. No COM+, no interop.
|
|
win-acme/win-acme
A simple ACME client for Windows (for use with Let's Encrypt et al.)
|
|
TechnitiumSoftware/DnsServer
Technitium DNS Server
|
|
dotnet/msbuild
The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
|
|
akkadotnet/akka.net
Canonical actor model implementation for .NET with local + distributed actors in C# and F#.
|
Version | Downloads | Last updated |
---|---|---|
10.0.0-preview.5.25280.105 | 0 | 6/2/2025 |
10.0.0-preview.5.25277.101 | 0 | 5/29/2025 |
10.0.0-preview.5.25266.103 | 0 | 5/20/2025 |
10.0.0-preview.4.25255.103 | 0 | 5/12/2025 |
4.6.0-preview.19073.11 | 5 | 1/28/2019 |
4.6.0-preview.18571.3 | 2 | 11/30/2018 |