I've got the same problem as this post - Namespace for [DataContract] however the solution isn't the same.
I've already got System.Runtime.Serialization referenced in the project and i'm targeting .net4. This was the answer for the previous question
Interestingly VS color coding seems to think this is valid but it does not compile.
References:
Error messages are:
The type or namespace name 'DataContractAttribute' could not be found (are you missing a using directive or an assembly reference?)
Same for DataContract, DataMemberAttribute, DataMember.
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.
Thinking it may work I closed project and re-opened but still doesn't work.
System.Runtime.Serialization
. Look carefully at error message, which class it is related to. - Dennis