Legacy configuration (app.config, web.config) provider implementation for Microsoft.Extensions.Configuration.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="AzureSqlDatabase" connectionString="[CONNECTION_STRING_HERE]" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="SampleAppSettingOne" value="Hello" />
<add key="SampleAppSettingTwo" value="World" />
</appSettings>
</configuration>
IConfiguration configuration = new ConfigurationBuilder()
.AddLegacyConfig("App.Config")
.Build();
Console.WriteLine($"App Settings: {configuration["SampleAppSettingOne"]}, {configuration["SampleAppSettingTwo"]}");
Make sure you have the following setup on your development machine:
- .NET Core 2.0.x
- .NET Framework 7.0
- Visual Studio 2017 or VS Code
Simply open the solution and build to get started.
- 0.0.2
- Added support for multiple configuration files.
- 0.0.1
- Initial release.
Haseeb Ahmed – @haseebahmed7 – [email protected]
Distributed under the MIT license. See LICENSE
for more information.
https://github.com/haseebahmed7/dotnetcore-legacy-configuration
- Fork it (https://github.com/haseebahmed7/dotnetcore-legacy-configuration)
- Create your feature branch (
git checkout -b yourname/feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request.
- Ben Foster, this project is based on his article.