C# XNA DataContractSerializer problem

Level 14
Joined
Oct 18, 2008
Messages
1,588
Hey guys,

I have a kinda strange problem with my project. I want to use the DataContractSerializer to serialize the model of my game with the references intact to make circular references work, but I have a problem importing the necessary assemblies.

After adding the serializer to the code, I get the following errors during building:

[highlight]Error 3 The type 'System.Xml.XmlWriter' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. C:\Users\Dániel\Documents\Visual Studio 2012\Projects\GameLibs\SpaceshipConquest\SpaceshipConquest\SpaceshipConquest\Model\GameState.cs 47 13 SpaceshipConquest[/code]

[highlight]Error 4 The type 'System.Xml.XmlReader' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. C:\Users\Dániel\Documents\Visual Studio 2012\Projects\GameLibs\SpaceshipConquest\SpaceshipConquest\SpaceshipConquest\Model\GameState.cs 62 21 SpaceshipConquest[/code]


Since the System.Xml assembly is already referenced I've tried to change the reference version in the project file - but this lead to a new error during runtime:

[highlight]File or assembly name 'System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089', or one of its dependencies, was not found.[/code]

Any idea how to solve this?
 
Top