Mithrilhall Mithrilhall - 26 days ago 7
C# Question

Centralize connection strings for multiple projects within the same solution

I currently have three projects in my solution that all have their own App.config file with the same exact connection string.

Is there a way to consolidate the connections strings / app.config files so that I only need to make changes to one location?

Answer

There's a few ways you could do it:

  1. Put common configuration settings in machine.config as shown here
  2. Put common configuration settings in a central file and link to that in each projects's app.config as shown here
  3. Store the configuration settings in the registry

For me, i always work with the last solution :) Good luck!

Comments