I have done my project with XNA and I'm currently trying to convert it while using Monogame.
My problem is that i can't load my XML file.
the error: Could not load Level asset as a non-content file!
My code: file = Content.Load<XmlData[]>(path);
Path = xml name file without extension. (i tried both).
class XMLData :
public class XmlData
{
public int id;
public int posx;
public int posy;
public int rot;
public int Width;
public int Height;
}
and some of my XML file:
<?xml version="1.0" encoding="utf-8" ?>
<Asset Type="MyDataTypes.XmlData[]">
<Item>
<id>17</id>
<posx>54</posx>
<posy>30</posy>
<rot>90</rot>
<Width>184</Width>
<Height>5</Height>
</Item>
I had a problem like this with XNA, I had to add the following line to my XML file <XnaContent> </XnaContent>
and I also had to add XML data as a library (even if it was only one class).
So what's the difference with Monogame? Why I can't load this XML file? In propriety, my xml file is a content.
Thanks for any help, I'll be grateful.
Edit: I thought I had found my problem here --> <Asset Type="MyDataTypes.XmlData[]">
I tried <Asset Type="XmlData[]">
cause i don't have MyDataTypes library anymore. I also tried with Content directory and asset directory. Nothing worked yet. I keep this post update.