web analytics

Multiple Web.Config in Visual Studio 2010

Previously it was a very difficult job to have configuration files for different application environments, like having config files for development and production environments. One had to manually change/copy/check config files for any deployment on any environment. This problem has been solved in a new feature that has been added to visual Studio 2010.

Mostly environment specific config files have different connection strings for development/production environments so when deploying you had to make sure you are applying the correct configuration file.

This problem is solved by visual studio 2010 that allows to build configuration specific config files. In VS 2010, whenever you create a new web application project now, you’ll see that your web.config in your solution explorer actually appears as an expandable node. When you expand it, you will see multiple configuration files for each of your build configurations, that can hold different values for each configuration.

Config

Now when you build your application in a specific build configuration, the correct web.config settings get applied. Similarly when you publish, the correct web.config settings get published.

One thought on “Multiple Web.Config in Visual Studio 2010

  • August 4, 2013 at 12:08 pm
    Permalink

    Hello, just wanted to mention, I loved this blog post.

    It was helpful. Keep on posting!

Leave a Reply

%d bloggers like this: