title: Type or namespace for datacontract
body: <p>I've got the same problem as this post - <a href="https://stackoverflow.com/questions/7401795/namespace-for-datacontract">Namespace for [DataContract]</a> however the solution isn't the same.</p>
  
  <p>I've already got System.Runtime.Serialization referenced in the project and i'm targeting .net4. This was the answer for the previous question</p>
  
  <p>Interestingly VS color coding seems to think this is valid but it does not compile.</p>
  
  <p><img src="https://i.stack.imgur.com/ZKNhG.jpg" alt="enter image description here"></p>
  
  <p>References:</p>
  
  <p><img src="https://i.stack.imgur.com/XpToF.jpg" alt="enter image description here"></p>
  
  <p>Error messages are:</p>
  
  <blockquote>
    <p>The type or namespace name 'DataContractAttribute' could not be found
    (are you missing a using directive or an assembly reference?)</p>
  </blockquote>
  
  <p>Same for DataContract, DataMemberAttribute, DataMember.</p>
  
  <p>The project i'm using defines a number of classes which i'm now wanting to serialize as data contracts and make available for another project. So this is not a WCF project but will be used in one later.</p>
  
  <p>Thinking it may work I closed project and re-opened but still doesn't work.</p>