System.Runtime.Serialization命名空间中不存在System.Runtime.Serialization.DataContractAttribute

Mr.*_*Zen 10 wcf serialization

我正在做一些WCF工作,我不明白为什么我遇到这个错误.

System.Runtime.Serialization.DataContractAttribute 在命名空间中不存在

System.Runtime.Serialization
Run Code Online (Sandbox Code Playgroud)

微软文档清楚地显示了这种层次结构

System.Object
  System.Attribute
    System.Runtime.Serialization.ContractNamespaceAttribute
Run Code Online (Sandbox Code Playgroud)

谁知道发生了什么事?

Dar*_*rov 36

确保已将System.Runtime.Serialization 组件的参考添加到项目中.