VS 2010 and web.config transformation

My current project is going through a chain of frequent QA and pre-production deployments. During each deployment I need to change a lot of web.config settings which are specific to QA or pre-production server. VS 2010 web.config transformation made my life easy in this situation. Here is how you can quickly get benefited from this-
1. Right click on web.config file and select “Add Config Transforms”. It adds two files – web.release.config and web.debug.config. Let’s consider web.debug.config as configuration file for QA server and web.release.config as configuration file for pre-production server.
2. Copy entire web.config file’s content to web.debug.config and web.release.config.
3. Modify Configuration tag line so that it reads like-

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"

4. Change settings in web.debug.config to fit for QA server and web.release.config to fit for pre-production server.
5. Select Debug or Release as required from build options and publish the site.

Published site’s web.config will contains contents as defined in web.debug.config or web.release.config instead of the original web.config.

For detailed information on web.config transformation, you may refer to this msdn blog.

This entry was posted in ASP.NET, Knowledge Sharing. Bookmark the permalink.

Leave a Reply