.Net 4.5.1将默认序列化方法设为“System.Xml”

时间:2014-09-05 02:50:51

标签: .net wcf serialization datacontractserializer .net-framework-version

我有一个非常可怕的问题,这耗费了我很多时间。我有使用.net framework 4.0和VS 2010构建的WCF服务。它与使用vs 2010和framework 4.0开发的Web应用程序完美配合(使用" DataContractSerialiser")。然后上周我将我的.net框架从4.0更新到4.5.1。现在我尝试更新上面的WCF服务,不幸的是它使用" System.Xml"序列化。而这个Web项目的构建失败,因为xml序列化完全不同于数据契约序列化。我该如何解决这个问题?

例如:

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.18408")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.datacontract.org/2004/07xxxxx.xxxx")]

1 个答案:

答案 0 :(得分:0)

我找到了解决方案。它发生了,因为项目使用Document.OpenXml作为参考。现在删除对项目的引用后,它使用运行时序列化程序

谢谢......:D