title: Update Web Reference in Visual Studio
body: <p>I have inherited a web site project that makes use of a number of WCF Web Services hosted on a BizTalk server. We have two environments that I need to deploy this project to, with different URLs for the different BizTalk servers.</p>
  
  <p>i.e. In the Staging environment, I need to point the services at <code>xx.xx.xx.101</code><br>
  In the Live environment, I need to point them at <code>xx.xx.xx.102</code>, or whatever.</p>
  
  <p>Currently, we've got all of the URLs stored in keys in the web.config file, so that we can change them dynamically. Unfortunately this isn't working.</p>
  
  <p>If I change the URL in the web.config to something other than what the project was compiled with, I get an error when calling the service:</p>
  
  <blockquote>
    <p>Server did not recognize the value of HTTP Header SOAPAction:
    xx.xx.xx.101\ServiceName\MethodName</p>
  </blockquote>
  
  <p>I'm told that the only way they've known to deploy this is to update the web.config URLs, change all of the web references in Visual Studio to match, click on "Update Web Reference" for each reference in Visual Studio, and then compile.</p>
  
  <p>I've written a pre-build NAnt script to go through and replace all instances of the URL found anywhere in the project directory, and even that isn't making any difference.</p>
  
  <p>There must be something else being pulled down from the service when I click the "Update Reference", but I'm not sure what.</p>
  
  <p>Does anyone have any ideas? Is there a way to do this programatically?</p>