How to use same App.config for multiple projects in Visual Studio

If you are one of those who love to separate your code throughout different projects in a solution, you probably will need to share the same App.config for multiple projects.

By default the Visual Studio build process will rename your configuration file from App.config to <ApplicationName>.exe.config , you are able to change the name but you won’t be able to read the configurations.

In my case I wanted to be able to read and update the configuration file from a Windows App and then used by a Windows Service App.

Initial solution setup:

Initial App.config for both projects:

We are going to use an external file to store the appSettings and ConnectionStrings parameters, final App.config for both projects will look like this:

AppSettings.config and ConnectionStrings.config files:

Final solution structure: