System.Configuration.ConfigurationManager
9.0.0
Prefix Reserved
dotnet add package System.Configuration.ConfigurationManager --version 9.0.0
NuGet\Install-Package System.Configuration.ConfigurationManager -Version 9.0.0
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.0" />
paket add System.Configuration.ConfigurationManager --version 9.0.0
#r "nuget: System.Configuration.ConfigurationManager, 9.0.0"
// Install System.Configuration.ConfigurationManager as a Cake Addin #addin nuget:?package=System.Configuration.ConfigurationManager&version=9.0.0 // Install System.Configuration.ConfigurationManager as a Cake Tool #tool nuget:?package=System.Configuration.ConfigurationManager&version=9.0.0
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. |
.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 (>= 9.0.0)
-
net8.0
- System.Diagnostics.EventLog (>= 9.0.0)
- System.Security.Cryptography.ProtectedData (>= 9.0.0)
-
net9.0
- System.Diagnostics.EventLog (>= 9.0.0)
- System.Security.Cryptography.ProtectedData (>= 9.0.0)
NuGet packages (2.4K)
Showing the top 5 NuGet packages that depend on System.Configuration.ConfigurationManager:
Package | Downloads |
---|---|
System.Runtime.Caching
Provides classes to use caching facilities. Commonly Used Types: System.Runtime.Caching.CacheEntryChangeMonitor System.Runtime.Caching.CacheEntryRemovedArguments System.Runtime.Caching.CacheEntryUpdateArguments System.Runtime.Caching.CacheItem System.Runtime.Caching.CacheItemPolicy System.Runtime.Caching.ChangeMonitor System.Runtime.Caching.FileChangeMonitor System.Runtime.Caching.HostFileChangeMonitor System.Runtime.Caching.MemoryCache System.Runtime.Caching.ObjectCache |
|
System.Diagnostics.PerformanceCounter
Provides the System.Diagnostics.PerformanceCounter class, which allows access to Windows performance counters. Commonly Used Types: System.Diagnostics.PerformanceCounter |
|
Microsoft.Data.SqlClient
The current data provider for SQL Server and Azure SQL databases. This has replaced System.Data.SqlClient. These classes provide access to SQL and encapsulate database-specific protocols, including tabular data stream (TDS). Commonly Used Types: Microsoft.Data.SqlClient.SqlConnection Microsoft.Data.SqlClient.SqlException Microsoft.Data.SqlClient.SqlParameter Microsoft.Data.SqlClient.SqlDataReader Microsoft.Data.SqlClient.SqlCommand Microsoft.Data.SqlClient.SqlTransaction Microsoft.Data.SqlClient.SqlParameterCollection Microsoft.Data.SqlClient.SqlClientFactory When using NuGet 3.x this package requires at least version 3.4. |
|
FluentAssertions
A very extensive set of extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style unit tests. Works with .NET Standard 2.0 and higher, .NET Framework 4.7 and higher and .NET 6 and higher. Supports the unit test frameworks MSTest2, NUnit3, NUnit4, XUnit2, XUnit3, MSpec and TUnit. Supported by InfoSupport B.V. |
|
EntityFramework
Entity Framework 6 (EF6) is a tried and tested object-relational mapper for .NET with many years of feature development and stabilization. |
GitHub repositories (275)
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 | |
---|---|---|---|
9.0.0 | 1,108,748 | 11/12/2024 | |
9.0.0-rc.2.24473.5 | 58,615 | 10/8/2024 | |
9.0.0-rc.1.24431.7 | 25,718 | 9/10/2024 | |
9.0.0-preview.7.24405.7 | 23,826 | 8/13/2024 | |
9.0.0-preview.6.24327.7 | 28,509 | 7/9/2024 | |
9.0.0-preview.5.24306.7 | 16,780 | 6/11/2024 | |
9.0.0-preview.4.24266.19 | 15,235 | 5/21/2024 | |
9.0.0-preview.3.24172.9 | 27,262 | 4/11/2024 | |
9.0.0-preview.2.24128.5 | 26,960 | 3/12/2024 | |
9.0.0-preview.1.24080.9 | 37,461 | 2/13/2024 | |
8.0.1 | 5,933,547 | 10/8/2024 | |
8.0.0 | 72,499,782 | 11/14/2023 | |
8.0.0-rc.2.23479.6 | 225,748 | 10/10/2023 | |
8.0.0-rc.1.23419.4 | 134,304 | 9/12/2023 | |
8.0.0-preview.7.23375.6 | 56,998 | 8/8/2023 | |
8.0.0-preview.6.23329.7 | 32,654 | 7/11/2023 | |
8.0.0-preview.5.23280.8 | 33,734 | 6/13/2023 | |
8.0.0-preview.4.23259.5 | 75,490 | 5/16/2023 | |
8.0.0-preview.3.23174.8 | 72,347 | 4/11/2023 | |
8.0.0-preview.2.23128.3 | 41,962 | 3/14/2023 | |
8.0.0-preview.1.23110.8 | 53,666 | 2/21/2023 | |
7.0.0 | 63,658,245 | 11/7/2022 | |
7.0.0-rc.2.22472.3 | 157,149 | 10/11/2022 | |
7.0.0-rc.1.22426.10 | 138,235 | 9/14/2022 | |
7.0.0-preview.7.22375.6 | 39,025 | 8/9/2022 | |
7.0.0-preview.6.22324.4 | 39,059 | 7/12/2022 | |
7.0.0-preview.5.22301.12 | 44,308 | 6/14/2022 | |
7.0.0-preview.4.22229.4 | 30,071 | 5/10/2022 | |
7.0.0-preview.3.22175.4 | 13,485 | 4/13/2022 | |
7.0.0-preview.2.22152.2 | 30,002 | 3/14/2022 | |
7.0.0-preview.1.22076.8 | 24,812 | 2/17/2022 | |
6.0.2 | 32,090 | 11/12/2024 | |
6.0.1 | 154,180,454 | 9/13/2022 | |
6.0.0 | 243,015,144 | 11/8/2021 | |
6.0.0-rc.2.21480.5 | 57,431 | 10/12/2021 | |
6.0.0-rc.1.21451.13 | 66,230 | 9/14/2021 | |
6.0.0-preview.7.21377.19 | 65,785 | 8/10/2021 | |
6.0.0-preview.6.21352.12 | 58,015 | 7/14/2021 | |
6.0.0-preview.5.21301.5 | 48,087 | 6/15/2021 | |
6.0.0-preview.4.21253.7 | 58,002 | 5/24/2021 | |
6.0.0-preview.3.21201.4 | 209,726 | 4/8/2021 | |
6.0.0-preview.2.21154.6 | 68,399 | 3/11/2021 | |
6.0.0-preview.1.21102.12 | 146,940 | 2/12/2021 | |
5.0.0 | 307,633,098 | 11/9/2020 | |
5.0.0-rc.2.20475.5 | 87,635 | 10/13/2020 | |
5.0.0-rc.1.20451.14 | 63,635 | 9/14/2020 | |
5.0.0-preview.8.20407.11 | 163,595 | 8/25/2020 | |
5.0.0-preview.7.20364.11 | 128,134 | 7/21/2020 | |
5.0.0-preview.6.20305.6 | 38,853 | 6/25/2020 | |
5.0.0-preview.5.20278.1 | 37,744 | 6/10/2020 | |
5.0.0-preview.4.20251.6 | 79,368 | 5/18/2020 | |
5.0.0-preview.3.20214.6 | 62,572 | 4/23/2020 | |
5.0.0-preview.2.20160.6 | 66,316 | 4/2/2020 | |
5.0.0-preview.1.20120.5 | 57,675 | 3/16/2020 | |
4.7.0 | 495,137,490 | 12/3/2019 | |
4.7.0-preview3.19551.4 | 69,135 | 11/13/2019 | |
4.7.0-preview2.19523.17 | 25,806 | 11/1/2019 | |
4.7.0-preview1.19504.10 | 34,478 | 10/15/2019 | |
4.6.0 | 53,864,096 | 9/23/2019 | |
4.6.0-rc1.19456.4 | 67,662 | 9/16/2019 | |
4.6.0-preview9.19421.4 | 26,791 | 9/4/2019 | |
4.6.0-preview9.19416.11 | 963 | 9/4/2019 | |
4.6.0-preview8.19405.3 | 101,459 | 8/13/2019 | |
4.6.0-preview7.19362.9 | 230,932 | 7/23/2019 | |
4.6.0-preview6.19303.8 | 1,133,906 | 6/12/2019 | |
4.6.0-preview6.19264.9 | 1,007 | 9/4/2019 | |
4.6.0-preview5.19224.8 | 63,628 | 5/6/2019 | |
4.6.0-preview4.19212.13 | 14,303 | 4/18/2019 | |
4.6.0-preview3.19128.7 | 79,501 | 3/6/2019 | |
4.6.0-preview.19073.11 | 61,160 | 1/29/2019 | |
4.6.0-preview.18571.3 | 133,305 | 12/3/2018 | |
4.5.0 | 447,458,115 | 5/29/2018 | |
4.5.0-rc1 | 218,001 | 5/6/2018 | |
4.5.0-preview2-26406-04 | 477,086 | 4/10/2018 | |
4.5.0-preview1-26216-02 | 474,857 | 2/26/2018 | |
4.5.0-preview1-25914-04 | 667,929 | 11/15/2017 | |
4.4.1 | 123,727,342 | 12/12/2017 | |
4.4.0 | 318,924,802 | 8/11/2017 | |
4.4.0-preview2-25405-01 | 107,782 | 6/27/2017 | |
4.4.0-preview1-25305-02 | 8,224 | 5/9/2017 |