title: Can't deserialize XML content in combined XNA-Silverlight WP7 project
body: <p>I have a combined XNA-Silverlight project that I am developing, and I am trying to add XML content to it. Before this, I had the following setup:</p>
  
  <ol>
  <li>Content Project </li>
  <li>XNA Game Library - references the content project</li>
  <li>Silverlight Project - references the XNA game library</li>
  </ol>
  
  <p>I had images in the content project, and I could compile and load them just fine from the Silverlight code. Now I am trying to add XML content to the content project and code to the game library that describes it, but I must be doing something wrong because I get the following error: <strong>There was an error while deserializing intermediate XML. Cannot find type "CrystalLib.Map"</strong></p>
  
  <p>In the content project I have a folder called maps, and under it I have the following xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;XnaContent&gt;
    &lt;Asset Type="CrystalLib.Map"&gt;
      &lt;TileSetFile&gt;grassland&lt;/TileSetFile&gt;
      &lt;Dimensions&gt;500 250&lt;/Dimensions&gt;
      &lt;Tiles&gt;
        ... Lots of integers (500 x 250)
      &lt;/Tiles&gt;
    &lt;/Asset&gt;
  &lt;/XnaContent&gt;
  </code></pre>
  
  <p>Then I have the following class in the xna game project (Map.cs):</p>
  
  <pre><code>using Microsoft.Xna.Framework;
  using Microsoft.Xna.Framework.Content;
  
  namespace CrystalLib
  {
      /// Represents the data stored in a map file
      class Map
      {
          /// The name of tile set file
          private string tileSetFile;
  
          /// The name of tile set file
          public string TileSetFile
          {
              get { return tileSetFile; }
              set { tileSetFile = value; }
          }
  
          /// The dimensions of the map, in tiles.
          private Point dimensions;
  
          /// The dimensions of the map, in tiles.
          public Point Dimensions
          {
              get { return dimensions; }
              set { dimensions = value; }
          }
  
          /// Spatial array for the tiles for this map.
          private int[] tiles;
  
          /// Spatial array for the tiles for this map.
          public int[] Tiles
          {
              get { return tiles; }
              set { tiles = value; }
          }
  
          /// Retrieves the base layer value for the given map position.
          public int GetTile(int x, int y)
          {
              return tiles[y * dimensions.X + x];
          }
  
          /// Read a Map object from the content pipeline.
          public class MapReader : ContentTypeReader&lt;Map&gt;
          {
              protected override Map Read(ContentReader input, Map existingInstance)
              {
                  Map map = existingInstance;
                  if (map == null)
                  {
                      map = new Map();
                  }
  
                  map.TileSetFile = input.ReadString();
                  map.Dimensions = input.ReadObject&lt;Point&gt;();
                  map.Tiles = input.ReadObject&lt;int[]&gt;();
  
                  return map;
              }
          }
      }
  }
  </code></pre>
  
  <p>What else do I need?</p>