Can't load XML file generated from XNA


I trying to port an old game made with an older version of MonoGame. I converted my project by adding a Content.mgcb in the content folder, replaced DLL, added the build target definition in my solution. All is fine, I can build the project by I can’t build all my assets.

I have some XML files for storing translations and levels. This is these files that can’t be converted by pipeline.exe. I have 11 errors like that

D:/Documents/Sources/thelostmaze/Maze3D/Content/Data/Levels/level_1.xml: error: Importer 'XmlImporter' had unexpected failure!
Microsoft.Xna.Framework.Content.Pipeline.InvalidContentException: Could not resolve type 'Data:Level'.
   … Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.IntermediateReader.ReadObject[T](ContentSerializerAttribute format, ContentTypeSerializer typeSerializer, T existingInstance)
   … Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.IntermediateReader.ReadObject[T](ContentSerializerAttribute format)
   … Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.IntermediateSerializer.Deserialize[T](XmlReader input, String referenceRelocationPath)
   … Microsoft.Xna.Framework.Content.Pipeline.XmlImporter.Import(String filename, ContentImporterContext context)
   … Microsoft.Xna.Framework.Content.Pipeline.ContentImporter`1.Microsoft.Xna.Framework.Content.Pipeline.IContentImporter.Import(String filename, ContentImporterContext context)

This is sample of a XML file

<?xml version="1.0" encoding="utf-8"?>
<XnaContent xmlns:Data="Maze3D.Data">
  <Asset Type="Data:Level">
    <Tiles>2 2 2 2 (All tiles data)</Tiles>

The XNA version doesn’t require a custom importer or anything else, all data has been compiled by IntermediateSerializer. In a previous MonoGame release (3.0 maybe) It works because the XNB are already built.

How can I solve this?


Should your Type be something else? Just “Level” maybe?

Well I have a shared library for all types used by xml files (the XNA way).

It’s basically Maze3D.Data.Level, Maze3D.Data.Inventory, etc… These files has been created using XNA’s IntermediateSerializer.

The main problem is that MGCB can’t create the xnb from these XML because it don’t know the type Maze3D.Data.XXX but XNA don’t know it too :wink:

Here’s how I’ve fixed this problem. In the Pipeline tool, select the project at the top of the upper left pane. In the lower left pane, click (Collection) next to Reference, then click the small box with the … in it on the right. Type in the full or relative path to the dll that contains your class definitions, then click OK. The Pipeline tool should now be able to resolve the classes in your XML to build your xnb files from the XML.

1 Like

Thanks, I’ll try that later this week :wink:

Well it works! Thanks a lot =D