In Visual Studio 2010, you can support multiple Web.Config and use the transform to create the right configuration for your environment.
http://blogs.msdn.com/webdevtools/archive/2009/05/04/web-deployment-web-config-transformation.aspx
Basically, we can create one default Web.Config and different Transformation files for each environment, for example.
Web.Debug.Config Web.Staging.Config Web.Production.Config
A Transformation file can override the value of a specific configuration item for an environment, for example.
<?xml version="1.0"?> <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <connectionStrings> <add name="personalDB" connectionString="Server=StagingBox; Database=personal; User Id=admin; password=StagingPersonalPassword" providerName="System.Data.SqlClient" xdt:Transform="Replace" xdt:Locator="Match(name)" /> <add name="professionalDB" connectionString="Server=StagingBox; Database=professional; User Id=professional; password=StagingProfessionalPassword" providerName="System.Data.SqlClient" xdt:Transform="Replace" xdt:Locator="Match(name)"/> </connectionStrings> </configuration>
Whenever we configure the build for this environment, Transformation is applied to the default Web.Config file.
source share