asp.net mvc - Problem using XmlSerializer to Serialize/Deserialize a class between a Silverlight Library and an MVC App -
This is my position:
The solution with three projects to me: 1) Silverlight app, 2) Silverlight Library, 3) asp.net-MVC web app.
Silverlight Library I have a class called "MyClass" in Silverlight app I Serial the class using XmlSerializer to XML and will send back XML in the database. I extract and use the MyClass in the Silverlight App to deserialize XML that is from time to time.
My problem comes when I try to deserialize that XML from within the Asp.Net-MVC application. Asp.Net-do this code within MVC application I use to XML deserialize to MyClass are:
MySilverlightLibrary.MyClassObjects.MyClass newMyClass = null; Assembly assembly = assembly Load ("MySleverlight Library. Missing Object"); Type ty = asshole. Gettype ("MySilverlightLibrary.MyClassObjects.MyClass", Truth); XmlSerializer theSerializer = New XmlSerializer (ty); If using {(XmlReader sr = XmlReader.Create (New StringReader (XmlText))) NewMyClass {= TheSerializerkDeserialize (SR) as MySilverlightLibrary.MyClassObjects.MyClass (String.IsNullOrEmpty (xmlText)!); }} This is a runtime error I get:
'/ Server error in the application
file or not load assembly Could System.Xml , version = 2.0.5.0, culture = neutral, publicKeyToken = 7cec85d7bea7798e 'or one of your dependencies. The system can not find the file specified.
Description: An uncontrolled exception occurred during the execution of the current Web request. Please review the stack trace for more information about the error and where the code has originated from it.
Exception Details: System.IO.FileNotFoundException: file could not load assembly System.Xml, Version = 2.0.5.0, Culture = neutral, PublicKeyToken = 7cec85d7bea7798e 'or one of its dependencies. The system can not find the specified file.
"System.Xml" reference
I've seen Silverlight library project "System.Xml" is 2.0.5.0 reference version, but 2.0.0.0 in Spnet-MVC app. I think this is likely to be due to the problem, but I can not decide how to fix it!
I am messing with this for some time and this is driving me crazy! As always, any help would be appreciated!
thanks
Jeff
You are right - your The cause of the problem made is the mismatch version. I believe that you can solve with this
Comments
Post a Comment