How to read AppSettings values from a .json file in ASP.NET Core

This has had a few twists and turns. I’ve modified this answer to be up to date with ASP.NET Core 2.0 (as of 26/02/2018). This is mostly taken from the official documentation: To work with settings in your ASP.NET application, it is recommended that you only instantiate a Configuration in your application’s Startup class. Then, … Read more

What is App.config in C#.NET? How to use it?

At its simplest, the app.config is an XML file with many predefined configuration sections available and support for custom configuration sections. A “configuration section” is a snippet of XML with a schema meant to store some type of information. Overview (MSDN) Connection String Configuration (MSDN) Settings can be configured using built-in configuration sections such as … Read more

C# DLL config file

It is not trivial to create a .NET configuration file for a .DLL, and for good reason. The .NET configuration mechanism has a lot of features built into it to facilitate easy upgrading/updating of the app, and to protect installed apps from trampling each others configuration files. There is a big difference between how a … Read more

App.Config Transformation for projects which are not Web Projects in Visual Studio?

I tried several solutions and here is the simplest I personally found. Dan pointed out in the comments that the original post belongs to Oleg Sych—thanks, Oleg! Here are the instructions: 1. Add an XML file for each configuration to the project. Typically you will have Debug and Release configurations so name your files App.Debug.config … Read more