更新服务引用会为枚举创建重复定义

时间:2015-07-09 11:56:09

标签: c# wcf

此合约不是新合约,我也已多次成功更新我的服务参考。但是这次VS构建在我更新服务引用时失败了。它说

  

错误5命名空间''已经包含了一个定义   ' AuditStatus'

        [DataContract]
    public enum AuditStatus : byte
    {
        [EnumMember]
        Both,
        [EnumMember]
        IsAudited,
        [EnumMember]
        IsNotAudited,
    }

   // After updating reference, two definitions for above data contract is generated.
     /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.34234")]
    [System.SerializableAttribute()]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.datacontract.org/2004/07/Presensoft.Server.Platform.DataContracts")]
    public enum AuditStatus {

        /// <remarks/>
        Both,

        /// <remarks/>
        IsAudited,

        /// <remarks/>
        IsNotAudited,
    }    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    [System.Runtime.Serialization.DataContractAttribute(Name="AuditStatus", Namespace="http://schemas.datacontract.org/2004/07/Presensoft.Server.Platform.DataContracts")]
    public enum AuditStatus : byte {

        [System.Runtime.Serialization.EnumMemberAttribute()]
        Both = 0,

        [System.Runtime.Serialization.EnumMemberAttribute()]
        IsAudited = 1,

        [System.Runtime.Serialization.EnumMemberAttribute()]
        IsNotAudited = 2,
    }

这里有什么问题?

1 个答案:

答案 0 :(得分:0)

引用Newtonsoft.json是罪魁祸首。 我发布了关于newtonsoft问题的新SO question