title: WCF DataContract only visible if service referenced from client exe, not DLL
body: <p>I have a simple WCF logging service..</p>
  
  <pre><code>namespace WCFServiceLibrary
  {
      [ServiceContract]
      public interface ILog
      {
          [OperationContract]
          string InsertLogItem(LogItem logItem);
      }
  
      [DataContract]
      public class LogItem
      {
          private string _Text = string.Empty;
  
          [DataMember]
          public string Text
          {
              get { return _Text; }
              set { _Text = value; }
          }
      }
  }
  </code></pre>
  
  <p>And I have a client, and a DLL, all in the same solution.</p>
  
  <p>If I reference the service from the Client, I can see the DataContract.
  If I reference the service from the DLL, I can NOT see the DataContract.</p>
  
  <p>By which I mean that it I reference the service as LogService, and have this code in the client...</p>
  
  <pre><code>static LogService.LogClient logService = new LogService.LogClient();
  //create log item - &lt;&lt;&lt; Compile error in DLL on following line &gt;&gt;&gt;
  var itemTolog = new LogService.LogItem { Text = "log this"}; 
  string result = logService.InsertLogItem(itemTolog);
  </code></pre>
  
  <p>then it works fine, but if the same code is in the DLL, then it will not compile due to LogService.LogItem not being visible, and reports the following error</p>
  
  <pre><code>The type or namespace name 'LogItem' does not exist in the namespace 'MyDll.LogService' (are you missing an assembly reference?)    
  </code></pre>
  
  <p>The dataContract "LogItem" is simply not  in the object explorer when the service is referenced from the dll, but it is if referenced from the client exe.</p>
  
  <p>What gives? Needless to say I want to reference the Service from the DLL.
  I've read elsewhere that you can only see the data contract if it is actively used in one of the service contracts, but it is. </p>