One config file for multiple environments

Posted by ho on Stack Overflow See other posts from Stack Overflow or by ho
Published on 2010-05-10T20:10:00Z Indexed on 2010/05/10 20:14 UTC
Read the original article Hit count: 282

Filed under:
|
|

I'm currently working with systems that has quite a lot of configuration settings that are environment specific (Dev, UAT, Production). Does anyone have any suggestions for minimizing the changes needed to the config file when moving between environments as well as minimizing the duplication of data in the config file?

It's mostly Application settings rather than User settings.

The way I'm doing it at the moment is something similar to this:

<DevConnectionString>xyz</DevConnectionString>
<DevInboundPath>xyz</DevInboundPath>
<DevProcessedPath>xyz</DevProcessedPath>
<UatConnectionString>xyz</UatConnectionString>
<UatInboundPath>xyz</UatInboundPath>
<UatProcessedPath>xyz</UatProcessedPath>
...
<Environment>Dev</Environment>

And then I have a class that reads in the Environment setting via the My.Settings class (it's VB project) and then uses that to decide what other settings to retrieve. This leads to too much duplication though so I'm not sure if it's worth it.

© Stack Overflow or respective owner

Related posts about winforms

Related posts about app.config