WCF distributed development Common error Resolution (4): The type or namespace name ' DataContract ' could is not found DataContract cannot find
We are developing a WCF project, and we have this error when we define the data contract:
DataContract, DataMember, DataMemberAttribute cannot be found, as shown in figure:
The type or namespace name ' DataContract ' could is found (are you missing a using directive or a assembly?) E:\CodesVs2008\WCFServiceIISHostFrankXuLei\WcfServiceLib\WcfServiceLib\IService1.cs 6 Wcfservicelib
The type or namespace name ' DataMember ' could is found (are you missing a using directive or a assembly?) E : \codesvs2008\wcfserviceiishostfrankxulei\wcfservicelib\wcfservicelib\iservice1.cs WcfServiceLib
The type or namespace name ' DataMemberAttribute ' could is found (are you missing a using directive or a assembly Rence?) E:\CodesVs2008\WCFServiceIISHostFrankXuLei\WcfServiceLib\WcfServiceLib\IService1.cs Wcfservicelib
Workaround, add a reference to the System.Runtime.Serialization assembly in your project.
Life Reference assembly:
Using System.Runtime.Serialization;
Compilation succeeds.