Xml Formatting / Cannot find IntermediateSerializer class?

Edit: I formatted my LevelData field arrays wrong, which explains the build error. However, the IntermediateSerializer assembly is no where to be found.

I’m currently attempting to import xml files in the Content Pipeline. After adding the necessary class library reference to the project and reformatting my xml file, I’m still encountering issues with the import being unable to find class fields. Looking at others’ code with similar issues, I don’t understand what I’m doing wrong.

C:/Users/MyName/Source/Repos/MonoGame/ProjectName/ProjectName/Content/Levels/Level1.xml: error: Importer 'XmlImporter' had unexpected failure!
Microsoft.Xna.Framework.Content.Pipeline.InvalidContentException: The Xml element `Metadata` is required!

Here is the xml file:

	<Asset Type="ProjectName.LevelData">

And here is the LevelData class:

namespace ProjectName
        public class LevelData
            public int[][] layout;
            public int[][] Metadata;        

I figured that writing a test class to a file would be the easiest way to understand how to format the input files correctly.

using System;
using System.Text;
using System.Xml;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;

           var test = new LevelData();
           var sb = new StringBuilder();
           using (XmlWriter writer = XmlWriter.Create(sb))
               IntermediateSerializer.Serialize(writer, test, null); //IntermediateSerializer does not exist and won't compile.

However, when I went to do so, I could not use the IntermediateSerializer class as I didn’t add the correct “using” statement. However, Microsoft.Xna.Framework.Content.Pipeline simply does not exist. The only available namespace is Microsoft.Xna.Framework.Content. Am I missing something glaringly obvious here?

To output a file, add a project or assembly reference to MonoGame.Framework.Content.Pipeline.dll.

Multidimensional arrays should be supported. If not, then that is a big that should be fixed.

That’s just the thing. I can’t seem to find MonoGame.Framework.Content.Pipeline.dll on my machine or in the available list of references to add.

If you used the Windows installer, you should be able to find it under C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools.

@KonajuGames - Isn’t there a way to register assemblies so that VS can find them easily in the Add Reference dialog? Maybe we should be doing that as part of installation.

Alright, I’ve successfully imported the assembly.
Now, upon attempting to serialize a LevelData object, I’m seeing

An unhandled exception of type 'System.NotImplementedException' occurred in        MonoGame.Framework.Content.Pipeline.dll
Additional information: Unhandled primitive type `System.Int32`!

To me, this makes no sense. How can the system fail to serialize a single int and yet deserialize an integer array perfectly fine? Do I need to create my own implementation?

Sorry to necro an old thread, but I spent a good 4 hours before coming across this thread (as I port over my XNA game that uses IntermediateSerializer in my game editor)

The current NuGet packages for the pipeline assemblies silently fail when using IntermediateSerializer.Deserialize (latest stable Serialize writes out a blank XML, even with a basic class.

I was close to pulling down the src and building to find to why, only to find this thread and realize that the content pipeline assemblies where already installed with the base monogame install.

I replaced the NuGet version of the pipeline with the version from the installed location C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools and Intermediate Serializer works great.

I feel the knowledge of these pipeline assemblies and where they are installed should be much more obvious (especially given the are in \MSBuild and not \Monogame… )

I did find a minor bug, which ill post in a diff thread.