title: WCF Service Reference - proxy not being generated when reusing types
body: <p>I have two C# (.NET v4.0) companion projects, a ASP.NET website and a "self-hosted" WCF Console application. The website code calls the WCF service for various things; both were written a couple of years ago, and have been working fine.</p>
  
  <p>Both the console app and web site share a common class library between them (called <code>MyLibrary</code> in this example); this is added as a reference to both projects.</p>
  
  <p>The console app is pretty simple - for example, I have <code>IService.cs</code>:</p>
  
  <pre><code>[ServiceContract]
  public interface IService
  {               
      [OperationContract]
      List&lt;MyLibrary.MyClass&gt; DoSomething(int ID);
  }
  </code></pre>
  
  <p>and then <code>Service.cs</code>:</p>
  
  <pre><code>public class Service : IService
  {
      public List&lt;MyLibrary.MyClass&gt; DoSomething(int ID)
      {
          // etc
          return result;
      }
  }
  </code></pre>
  
  <p>... and all of this works. However, today I've needed to add something trivial to both sides - one of the methods needs to have another parameter added. I've updated the WCF app, built it, ran it, and then gone to the website and tried to "Update Service Reference".</p>
  
  <p>At this point, the site broke: generating the service reference is no longer creating a proxy. However, if I deselect the option to "Reuse all references", the proxy is created: this breaks my code massively though, I need to share the references to <code>MyLibrary</code> all through the code.</p>
  
  <p>After doing some digging, I've attempted to create the reference using <code>svcutil</code>:</p>
  
  <p><code>svcutil /t:code http://localhost/MyService /r MyLibrary.dll</code></p>
  
  <p>which throws the error:</p>
  
  <pre><code>Attempting to download metadata from 'http://localhost/MyService' using WS-Metadata Exchange or DISCO. Error: Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter    
  Error: Referenced type 'MyLibrary.MyClass, MyLibrary, Version=2.0.53
  33.26816, Culture=neutral, PublicKeyToken=null' with data contract name 'MyLibrary.MyClass' in namespace 'http://schemas.datacontract.org/2004/07/MyService' cannot be used since it does not match imported DataContract. Need to exclude this type from referenced types.    
  XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IService']
  </code></pre>
  
  <p>I cannot figure out what's gone wrong; I've seen other posts about this error, but they all mention making sure the referenced class is the same - the WCF app is using the same code in <code>MyLibrary</code> as I'm calling with <code>svcutil</code> above; both are being compiled at the same time. Also, I'm not doing anything differently that I haven't done dozens of times before.</p>
  
  <p>Can anyone suggest where to start troubleshooting this issue? Apologies in advance if I've mangled any of the syntax in my code examples during obfuscation :)</p>