visual-studio-2015web-config-transform

Which config transform is applied when running in Visual Studio?


Which config transform is applied when running in Visual Studio?

We have a web config and a series of config transforms that set the connection string value for Dev/Test/Live environments. These transforms work fine when the site is published.

To avoid confusion, I replaced the default value with set_in_transform ala ...

<connectionStrings>
      <add name="LLPG.Connection"
           connectionString="set_in_transform"/>
 </connectionStrings>

However if we just run the site in Visual Studio, the set_in_transform value isn't been set.

Is a config transform actually run when you run in Visual Studio?


Solution

  • If you run using IIS Express, then no transform is applied, the main web.config is used. Transforms are applied when you deploy to some IIS (whether is your local IIS or in a server).

    It's possible to deploy to local IIS (then transform is applied), and use attach to debug it (as long as you keep debug attributes in web.config).