views:

127

answers:

1

I'm trying to publish an XNA game through the Visual Studio Publish tool. The game uses some compiled and some non-compiled content. Basically, I have a level loaded in via XML serialization and a short video. These two files are essentially streamed in, so they aren't compiled. The publish tool includes the compiled content fine, but any references to relative paths are broken because the CurrentDirectory for installed programs are set in the AppData folder.

I know that XNA can now compile XML without having to write custom content processors, but I don't particularly want to go back to rewrite that. I suppose I can if there's no other option, but that still doesn't remedy the video problem.

Is there any way to set up the publish tool so that I can do what I need to do? A setting or something? Or will I need to use a more fully-featured tool like NSIS?

+5  A: 

Right click project, Add Existing Resource, browse and select the file you want to add. Then right click the file and click properties and change "Build Action" to content, and "Copy To Output Directory" to Copy if newer (or copy always if the need be). Then you can access it by using the relative path.

I use this for my XML and I can access my content using the following code:

XmlDocument document = new XmlDocument();
document.Load("Resources/DefaultConfig.xml");

Please note that my DefaultConfig.xml file is inside a "Resoruces" Directory which I created in Visual Studio(this is optional, but it helps me keep my project neat)

LnDCobra
Thanks a lot! I finally got it. For some reason, the XML file also had to be in the Content directory. Once I figured that out, it worked.
Seth