Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Page History: Web.Config Transformations - Visual Studio 2010

Compare Page Revisions



« Older Revision - Back to Page History - Current Revision


Page Revision: Thu, Oct 13, 2011, 2:04 PM


Overview

To facilitate the dependency of configuration settings to environment, Visual Studio 2010 introduced what is called web.config transformations. This articles describes how to use them.

Walk-Through

  • In addition to the traditional web.config file, there is now a web.abc.config file for each build configuration in your solution, where abc is the name of the build configuration.

  • To modify an entry in the <appSettings> node, use the following example.

<appSettings>
  <add key="EmailServer" value="MyMailServer"
      xdt:Transform="SetAttributes" xdt:Locator="Match(key)"
        />
</appSettings>

  • To modify a connection string (i.e., in the <connectionStrings> node, use the following example.

<connectionStrings>
    <add
      name="Same-Name-A-sWeb.Config-File"
      xdt:Transform="SetAttributes"
      xdt:Locator="Match(name)"
      connectionString="New-Connection-String"
      providerName="System.Data.SqlClient"
   />
</connectionStrings>

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.