Bharathi Gurusheve
Bharathi Gurusheve

Reputation: 29

XNA error - file not found

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

Upvotes: 0

Views: 316

Answers (3)

Priyank
Priyank

Reputation: 145

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.

Upvotes: 0

WoLfulus
WoLfulus

Reputation: 1977

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

Upvotes: 1

keyboardP
keyboardP

Reputation: 69372

Try adding the extension:

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

Upvotes: 0

Related Questions