Environments and web.config deployment

Topics: Data Access Application Block, General discussion
Apr 20, 2007 at 6:51 PM
It seems the help documentation is missing the Environment capability the entlib3 has. Can someone point me to a few good links that would show me the best way to some things like:
Use a different connection string in QA and Prod then dev. I read this link: http://bloggingabout.net/blogs/olaf/archive/2007/02/18/environmental-overrides-made-it-into-entlib-v3.aspx and see how to accomplish it but it doesn't mention where the QA or Production web.config files exist. I see the .dconfig file but where does the merge file get placed? And is anyone using a TeamBuild to swap out the dev web.config with the QA web.config in the build process? Any pointers would save me a few headaches.

(Why isn't there an Environment tag?)
Apr 23, 2007 at 5:38 PM
It is documented at the very beginning of the help file. Look under Introduction to the Enterprise Library -> Specifying Environment-Specific Configuration Settings . It doesn't do the topic justice, however, as this is indeed a very cool feature developed by Olaf.

Here are some links for posts I have written on the subject in addition to Olaf's:

Environmental Overrides in Enterprise Library 3.0 - Managing Development, Test, Staging, and Production Configurations Made Easy!

Environmental Overrides in Enterprise Library 3.0

Automated Environmental Overrides Merging via Batch File or NAnt Build File

You can run it as part of the build process. In fact, I think it is the best way. See the post above that discusses the MergeConfiguration.exe console application.

Hope this helps,



David Hayden
Microsoft MVP C#
Jul 9, 2007 at 11:51 PM
I am still a little confused. I have read all the articles and several others but none of them address my issue. I am able to add the environments and update the settings per environment. I can see the Production.config & Production.dconfig files in my project after right clicking the Production environment and selecting "Save Merged Configuration", but that is as far as any of the documentation goes. My question is when I publish this site to the production server how does it know to look at the Production.config rather than the web.config (because the web.config has the wrong connection strings obviously)?????

I'm sure I'm missing something totally obvious...

Thanks for your help!