Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use partial config files

I am involved in a project where development and testing is going on in different locations. There are a few entries in the app.config that are "local" to the different locations (hence, "config"). Therefore, everyone tends to keep his own app.config, which always makes it difficult for a new setting to be introduced.

I'm looking for an idea, something like partial classes, where the bulk of an app.config can be in one place, and a few items in another, and yet all wind up in the proper exe.config after a build.

like image 203
Kelly Cline Avatar asked Sep 14 '11 13:09

Kelly Cline


1 Answers

First of all you can split up config file using the configSource attribute. For example, in web.config you could write:

    <authentication configSource="ConfigFiles\authentication.config" />

.. and have your authentication config in another file. This may be of use to you, with local variations (eg. DB settings).

Secondly, and more importantly, you probably want to watch this video to learn about deploying to different environments (using web.debug.config and web.release.config)

http://www.hanselman.com/blog/WebDeploymentMadeAwesomeIfYoureUsingXCopyYoureDoingItWrong.aspx

like image 127
Mark Robinson Avatar answered Sep 28 '22 01:09

Mark Robinson