If you use the MSBuild extension pack the Xml task will allow you to change an entry in an XML file. Import the custom tasks in your MSBuild file:
<Import Project="$(MSBuildExtensionsPath)\ExtensionPack\MSBuild.ExtensionPack.tasks" />
and update an 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)"
/>
Substitute your XPath and only execute this during a release build using Condition .