Can variables be included in the web.config conversion file? For each environment, I have basically the same transformation, only with different values. For example, for a development environment, I would have ...
<?xml version="1.0"?> <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <appSettings> <add key="serverName" value="server1" xdt:Transform="Replace" xdt:Locator="Match(key)" /> <add key="serverPath" value="\\server1" xdt:Transform="Replace" xdt:Locator="Match(key)" /> </appSettings> </configuration>
And for a QA environment, I would have ...
<?xml version="1.0"?> <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <appSettings> <add key="serverName" value="server2" xdt:Transform="Replace" xdt:Locator="Match(key)" /> <add key="serverPath" value="\\server2" xdt:Transform="Replace" xdt:Locator="Match(key)" /> </appSettings> </configuration>
The only difference is the value for server1 vs server2. This is a simple example, and in fact I use the server value several times in the conversion. Is there a way to declare a variable in a transform file that will be used multiple times? Something like...
<?xml version="1.0"?> <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <property name="server" value="server2" /> <appSettings> <add key="serverName" value="${server}" xdt:Transform="Replace" xdt:Locator="Match(key)" /> <add key="serverPath" value="\\${server}" xdt:Transform="Replace" xdt:Locator="Match(key)" /> </appSettings> </configuration>
Rob gibbens
source share