Visual Studio 2010: Multiple web.config versions

Visual Studio 2010 has support for multiple web.config files. It is one feature of new web application packaging and deployment system. We can create now separate web.config files for each configuration we have for application.

Multiple web.config filesWhen web application is created then it has two configurations: Debug and Release. Visual Studio 2010 creates also two versions of web.config file as is seen on the image. Depending on active configuration correct web.config will be selected. This technique is called web.config transformation and it allows very powerful transformations of configuration files.

We can easily add new configurations and add web.config files for them right through Visual Studio 2010 IDE.

Web.config file is like template for configurations. Also you can handle it as default configuration. Configuration specific configuration files may add settings or change current ones. This is done using simple transformation tags.

Visual Studio 2010 also allows generation of web.config versions using command-line and MSBuild.

Visual Web Developer Team Blog has very good posting about web.config transformation. This posting is titled as Web Deployment: Web.Config Transformation and it gives you complete overview about transformations and packaging of web.config files.

If you want to try these things out on hosting environment then take a look at my blog entry Free ASP.NET 4.0 beta hosting available and Visual Web Developer Team Blog entry Free Web Hosting to try ASP.NET 4 Beta1, VS 2010 Beta1 and MS Web Deployment Tool RC1.


One thought on “Visual Studio 2010: Multiple web.config versions

Leave a Reply

Your email address will not be published. Required fields are marked *