Application Configuration for different environments
Posted on 2009-02-15
I write a lot of VB.Net desktop applications and I make use of the configuration file a lot. The problem is that the application would go through so many environments like DEV, TEST, UAT and ultimately production. Many times more than production environment (different sites or domains).
It is very tedious chaning all the connections strings, UNC paths and credentials stored in the config file when changing between environments. I've been able to work around this by creating a seperate setting for each environment and name it sloghtly different like ConStr_Dev, ConStr_Test, ConStr_Prod and then have another setting called environment which would contain _Dev, _Test or _Prod. Changing this one setting would then allow the code to dynamically adjust.
It's not the cleanest way and I was hoping the new .Net 3.5 would provide a built-in feature to cater for this. Something like different configuration groups that would all have the same settings/structure but different values...
Please advice me