0

I am working on XNA with XML reading. While I'm debugging the code its shows file not found error, but I added my XML file in Content reference folder. While I'm using this code I got the error.

System.IO.Stream stream = TitleContainer.OpenStream("ProductSchema");

Thanks in advance.

Bharathi.G

Neil Knight
  • 47,437
  • 25
  • 129
  • 188

3 Answers3

1

Shawn explains this very well in this post: Shawn's blog entry

WoLfulus
  • 1,948
  • 1
  • 14
  • 21
0

Try adding the extension:

System.IO.Stream stream = TitleContainer.OpenStream("ProductSchema.xml");
keyboardP
  • 68,824
  • 13
  • 156
  • 205
0

Check whether that file is present in the bin folder where your game .exe file lives (bin\Windows Phone\Debug\Content). If not, then this may be the problem. To solve this :

right click the file >> select property >> change build action to None and copy to output directory to Copy if newer.

This works for me while loading/reading binary files in my game.

Priyank
  • 145
  • 1
  • 2
  • 11