If you use the MSBuild extension package , the Xml task will allow you to modify the entry in the XML file. Import custom tasks into the MSBuild file:
<Import Project="$(MSBuildExtensionsPath)\ExtensionPack\MSBuild.ExtensionPack.tasks" />
and update the XML value:
<PropertyGroup>
<OldValue>http://debug.example.com/Endpoint.asmx</OldValue>
<NewValue>http://live.example.com/Endpoint.asmx</NewValue>
</PropertyGroup>
<MSBuild.ExtensionPack.Xml.XmlFile
TaskAction="UpdateAttribute"
File="app.config"
XPath="/configuration/system.serviceModel/client/endpoint[@address='$(OldValue)']"
Key="address"
Value="$(NewValue)"
/>
Replace your XPath and execute it only during release build using the condition.
source
share