System.Configuration.ConfigurationManager
10.0.0-preview.5.25277.101
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" />
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"
// Install System.Configuration.ConfigurationManager as a Cake Addin #addin nuget:?package=System.Configuration.ConfigurationManager&version=10.0.0-preview.5.25277.101&prerelease // Install System.Configuration.ConfigurationManager as a Cake Tool #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. net10.0 is compatible. |
.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 5 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
|
Version | Downloads | Last updated |
---|---|---|
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 |