I have several projects and a website in a large asp.net solution. In some of projects I have an app.config file and in the website I have my web.config. In each config I specify several things that are common amongst them, such as connection strings. Is there any way to consolidate these common items into one config file and reference that from the various projects that need them?
+1
A:
You can do this with a pre/post compile step in the project to copy the config file from say the solution directory.
A few years back, this was the solution that was recommended by scott hanselman.
DevelopingChris
2008-12-03 20:14:59
+1
A:
You can reference external config files in any .config (see http://www.peterprovost.org/blog/post/External-Config-Files-in-NET.aspx).
Each project has a config file; these files get published to the bin directory as [output name].config (e.g., MyCode.DLL, MyCode.DLL.config). You can then reference these .config files from your main config (web.config).
If you find your config files aren't finding their way to the correct destination, you can do the post compilation step that ChanChan mentioned.
Will
2008-12-03 20:19:23