Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been trying so long to use this modified version of GLEED2D that includes WP7 support,

I'm stuck into loading the level into my game, now my Game1.cs class has the following:

    protected override void Initialize()

        Stream stream = TitleContainer.OpenStream("Content/leveltest.xml");
        XElement xml = XElement.Load(stream);
        level = LevelLoader.Load(xml);

I included the XML file of my level into Content Directory, when I try to build the solution, It gives this error:

XML is not in the XNA intermediate format. Missing XnaContent root element.

I didn't find any reference on how to fix it on the developer's blog or the github WiKi

Any Idea?

share|improve this question
You need to look at this tutorial for loading XML in XNA: – John McDonald Jan 29 '12 at 5:54
@JohnMcDonald I just did that, what should I replace the "<Asset Type="MyDataTypes.PetData[]">" in the example with ? – SKandeel Jan 29 '12 at 6:21
up vote 4 down vote accepted

The problem is that you're trying to build the XML file using the XNA's Content Pipeline. However, in the source code you posted, the XML file is being loaded at runtime using the LINQ to XML API (XDocument) so it doesn't need to go through the content pipeline.

To solve the problem, go to the Solution Explorer, browse into your Content project to your XML file, and then on its Properties, change the Build Action property from Compile to Content, and also enable the Copy to Output Directory property. See picture below:

enter image description here

This way your XML file will still be copied to the Content folder, without being built by the XNA's Content Pipeline.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.