Search code examples
xnatext-filesxna-4.0xna-3.0

How do I add a text file to an XNA 4 Content project?


I am trying to add a .txt file to the content project in my XNA game project (XNA 4).

When I do 'Add -> New Item...' on the content project I can only choose from 4 options (Bitmap, XML, Effect and Sprite Font).

If I try and force a txt file through typing 'test.txt' in the Name field, Visual Studio 2010 hard crashes (although the file appears, and it has some bytes of data that looks like it tried to force a bmp into it).

Anyone have any ideas about how to do this? I can see in the Windows Platformer Starter Kit for XNA 3 they have txt files in the Content project. Is this not allowed in XNA 4?


Solution

  • Why would you want to add txt files to your content? The XNA content is only meant for files that need some sort of processing. If you want to use some txt file, you should probably just add it to the folder that your game is running in. Alternativeley, just add it as a sourcecode file, so not to the content but to the actual project iself.