title: WCF service reference namespace differs from original
body: <p>I'm having a problem regarding namespaces used by my service references. I have a number of WCF services, say with the namespace <code>MyCompany.Services.MyProduct</code> (<em>the actual namespaces are longer</em>).<br/>
  As part of the product, I'm also providing a sample C# .NET website. This web application uses the namespace <code>MyCompany.MyProduct</code>.</p>
  
  <p>During initial development, the service was added as a project reference to the website and uses directly. I used a factory pattern that returns an object instance that implements <code>MyCompany.Services.MyProduct.IMyService</code>. So far, so good.</p>
  
  <p>Now I want to change this to use an actual service reference. After adding the reference and typing <code>MyCompany.Services.MyProduct</code> in the namespace textbox, it generates classes in the namespace <strong>MyCompany.MyProduct.MyCompany.Services.MyProduct</strong>. <em>BAD!</em> I don't want to have to change <code>using</code> directives in several places just because I'm using a proxy class. So I tried prepending the namespace with <code>global::</code>, but that is not accepted.</p>
  
  <p>Note that I hadn't even deleted the original assembly references yet, and "reuse types" is enabled, but no reusing was done, apparently. <strong>However, I don't want to keep the assembly references around in my sample website for it to work anyway</strong>.</p>
  
  <p>The only solution I've come up with so far is setting the default namespace for my web application to <code>MyCompany</code> (because it cannot be empty), and adding the service reference as <code>Services.MyProduct</code>. Suppose that a customer wants to use my sample website as a starting point, and they change the default namespace to <code>OtherCompany.Whatever</code>, this will obviously break my workaround.</p>
  
  <p>Is there a good solution to this problem?</p>
  
  <p><strong>To summarize</strong>: I want to generate a service reference proxy in the original namespace, without referencing the assembly.</p>
  
  <p>Note: I have seen <a href="https://stackoverflow.com/questions/1165116/wcf-proxy-types-are-in-a-different-namespace-than-wcf-service-types">this question</a>, but there was no solution provided that is acceptable for my use case.</p>
  
  <hr>
  
  <p>Edit: As John Saunders suggested, I've submitted some feedback to Microsoft about this:<br/>
  <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=478305" rel="nofollow noreferrer">Feedback item @ Microsoft Connect</a></p>