Search code examples
.netwcfserializationdatacontractserializer.net-framework-version

.Net 4.5.1 makes default serialization method as "System.Xml"


I have very terrible question, which wast lots of my time. I have WCF Service which was build using .net framework 4.0 and VS 2010. It works perfectly (using "DataContractSerialiser" ) with the web application developed using vs 2010 and framework 4.0. Then last week I have Updated my .net framework from 4.0 to 4.5.1. Now I tried to update above WCF service, Unfortunately it serialize using "System.Xml". And this failed build of the web project because xml serialization completely difference to the data contract serialization. How can I fix this issue ?

Ex:

[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")]

Solution

  • I have found the solution. It's happened, because project use Document.OpenXml as reference. After removing the reference to the project now it use runtime serializer

    Thank you ... :D