Publish is not transforming web.config? Publish is not transforming web.config? asp.net asp.net

Publish is not transforming web.config?


Answering late but perhaps I can save someone a headache. In Visual Studio 2013, there are two places to select configuration for your build and deploy. The Configuration Manager and then again with Publish Web where the third step in the Wizard entitled Settings allows you to select Config you want to use. If you don't select your new configuration it will use the transform for the selected configuration instead of yours.


I found out two things:

  • You cannot set a namespace on the <configuration> tag (ex: for <location path="." inheritInChildApplications="false">)
  • You have to watch for the correct hierarchy in the transform file.

Like

<configuration>  <location>    <connectionStrings>

Instead of

<configuration>  <connectionStrings>


Ensure that in the properties of the Web.Config file Build Action is set to Content.

If the build action is set to None, it will not be transformed, even if it is being copied to the output directory.