Click here to Skip to main content
15,885,651 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

Background


When you create a new web project in Visual Studio, you start with 2 web.config transformation files by default:
Web.config
  Web.Debug.config
  Web.Release.config

Goal


However, I'd like to transform the output of those transformations by nesting a level deeper:
Web.config
  Web.Debug.config
  Web.Release.config
    Web.Release.Azure.config
    Web.Release.WebServer.config

Attempt


I was able to create a new solution configuration with a corresponding project configuration called "Release.Azure". I was also able to create the new transform file (Web.Release.Azure.config) and I edited the csproj file to nest that file under Web.Release.config (as shown in the above diagram):
XML
<Content Include="Web.Release.Azure.config">
  <DependentUpon>Web.Release.config</DependentUpon>
</Content>

Problem


However, when I published against the Release.Azure configuration, the Web.Release.Azure.config file directly transformed the Web.config file, rather transforming the output of the Web.Release.config transformation of the Web.config file.

Is there a way to nest / chain web.config transformations, so that I can reduce the amount of typing I have to repeat in each configuration?

Example


Here is a simple scenario where I'd want to do this. Suppose all release configurations have the same connection strings (say, to 500 different databases). I'd put that into Web.Release.config. However, I might want to use InProc session for a WebServer release and Database session for an Azure release (so the session would be configured differently in Web.Release.Azure.config and Web.Release.WebServer.config).
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900