XNA Distribution Always Failing

Started by
4 comments, last by kobuscrispi 14 years, 8 months ago
I have spent all day looking up and trying different methods to distribute a .exe file of an XNA game. I made almost the simplest project possible (basically the XNA default game template with one picture added), and then tried the ClickOnce publish, and also tried using Nuclex's XNA installer to detect or install the XNA and .NET frameworks, and tried to have both people who DO have them already and people who don't, and it failed to work on both machines, despite working on mine. I am absolutely out of ideas as to why this isn't working, let alone how to make it work. I'm programming this on Vista, and I've tried using both Visual C# Express 2008 and SharpDevelop. If anyone has any further suggestions, I'm all ears.
Advertisement
The built-in publish isn't too useful from what I've seen. Personally I put the contents of the bin/x86/release folder into an installer (Inno and Nullsoft are both good free ones). Or you can just zip the release folder if you just want to give it to a friend.

Also, are all your game IO file paths relative or absolute? That is the most common cause of distribution failure. Your paths should all be relative to the current directory the game .exe is running in. I use:

string IOPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);


So all game files should be loaded/saved using that path as base, something like:

string playerSaveFile = IOPath + "\\save\\player.txt"
Quote:Original post by EJH
Also, are all your game IO file paths relative or absolute? That is the most common cause of distribution failure. Your paths should all be relative to the current directory the game .exe is running in.


Currently, I'm using the provided features in VC#08 for adding content to the solution, and it doesn't give me the option of changing the filename, nor is there any indication of whether it's using relative or absolute paths. My code for loading the resource just says:

mSpriteTexture = this.Content.Load<Texture2D>("hero");

Am I doing something seriously wrong here?
Quote:Original post by kobuscrispi
Quote:Original post by EJH
Also, are all your game IO file paths relative or absolute? That is the most common cause of distribution failure. Your paths should all be relative to the current directory the game .exe is running in.


Currently, I'm using the provided features in VC#08 for adding content to the solution, and it doesn't give me the option of changing the filename, nor is there any indication of whether it's using relative or absolute paths. My code for loading the resource just says:

mSpriteTexture = this.Content.Load<Texture2D>("hero");

Am I doing something seriously wrong here?


I had to make paths to content relative because of exactly what is happening to you. Here's what I did:

// first define a base IOPath for all filesstring IOPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);// when loading models or textures// use the base path + relative pathModel m = new Model();m = ContentManager.Load<Model>(IOPath + "\\Content\\Models\\myModel.x");
Quote:Original post by EJH
I had to make paths to content relative because of exactly what is happening to you. Here's what I did:

Then something is wrong. You shouldn't have to specify the root game folder for the ContentManager. Normally you just set the RootDirectory property:

Content.RootDirectory = "Content";

Also, you don't use the extension for the content file as each piece of content is compiled into a file with an .xnb extension. You use the Asset Name property of the content, which by default is the file name without the extension.

Former Microsoft XNA and Xbox MVP | Check out my blog for random ramblings on game development

Tried what EJH suggested. Compiles and runs fine on my computer, but still suffers from exactly the same problem on other machines.

Error is as follows:

Description:
Stopped working

Files that help describe the problem:
C:\Users\Li-Chi\AppData\Local\Temp\WER615.tmp.version.txt
C:\Users\Li-Chi\AppData\Local\Temp\WER5252.tmp.hdmp

Read our privacy statement:
http://go.microsoft.com/fwlink/?linkid=50163&clcid=0x0409


Not very useful, I know.

This topic is closed to new replies.

Advertisement