Reputation: 2043
I am currently using variable substitution in VSTS however I have hit a roadblock on how to select specific elements from a list.
I must supply both a name for the variable I want to substitute and a key with which to substitute the old value. I can use .
to select nested elements in config.
I have the following app.config.
<services>
<service behaviorConfiguration="ServiceBehaviour" name="Application.Project01">
<endpoint address="" behaviorConfiguration="webBehavior" binding="webHttpBinding" bindingConfiguration="web" contract="Application.Interface01">
<identity>
<dns value="dns01" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/Project01/" />
</baseAddresses>
</host>
</service>
<service behaviorConfiguration="ServiceBehaviour" name="Application.Project02">
<endpoint address="" behaviorConfiguration="webBehavior" binding="webHttpBinding" bindingConfiguration="web" contract="Application.Interface02">
<identity>
<dns value="dns01" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/Project02/" />
</baseAddresses>
</host>
</service>
</services>
I would like to be able to substitute variables in each one of these services individually. The specific keys I am interested in are services.service.endpoint.identity.dns.value
and services.host.baseaddresses.add.baseaddress
.
I have tried the following to edit the dns value
services.1.service.endpoint.identity.dns
services.1.service.endpoint.identity.dns.value
The task that I am using is the Azure App Service Deploy version 3.*
Upvotes: 1
Views: 273
Reputation: 33738
For XML variable substitution feature of Azure App Service Deploy task, it takes effect only on the applicationSettings, appSettings, connectionStrings, and configSections elements of configuration files.
So you can’t use it to achieve your requirement.
You can try it with XML Transformation.
You also can try it with other tasks, such as Release Management Utility tasks or others.
Upvotes: 1