Jump to content
  • Advertisement
Sign in to follow this  
Khaosz

[XNA & C#] Distributing XNA game

This topic is 3657 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, Together with a friend of mine I'm working on a 2d mmo game. I'm mostly in charge of coding (C# using XNA) and he's taking care of graphics (sprites). The coding is getting along pretty good so I wanted to show him the current progress. I sent him my client but when he tries to run it an exception is thrown and the program shuts down. After catching and printing the exception this is what he sees: http://chronoxdesign.nl/files/cmd.JPG (I apologize it is in dutch. The dutch part translated is: "The application could not be started because the setup of the application is not correct. Reinstalling the application can solve this problem") Pretty weird, since I'm sure he has installed the XNA framework. Also, when I run it on my pc (developing primary on my laptop) it runs normal. He tried reinstalling XNA and the .NET framework. It didn't help. I tried to find a solution on google and gamedev.net. The only thing I found where problems with Vista/XP 64 bit. Does anyone knows the solution for this problem? I would be very thankful!

Share this post


Link to post
Share on other sites
Advertisement

Odd... XNA 1 deployment was quite a nightmare, but with XNA 2.0 I didn't have these troubles. Are you sure your friend installed the XNA runtime correctly (try having him run a sample from the Creators site)? It's probably a silly question, but the message does state the XNA assembly/DLL could not be found. Maybe he installed the XNA 1.1 (or Refresh) runtime instead of the 2.0 one?

Another random guess would be to update the DirectX runtime to the latest version. Just maybe it fails to load the XNA runtimes because the DX runtime is outdated.

Share this post


Link to post
Share on other sites
I'd recommend making an installer for your app. Personally what I do is I use Inno Setup to create an instealler script which includes all the necessary content files and executables. Then I add some code to the script that executes the installers for .NET 2.0, C++ Runtime, XNA Framework, and DirectX Runtime. It's very easy to do...in fact I don't mind sharing my script code for that if you'd like.

Share this post


Link to post
Share on other sites
Here ya go:


; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{DF860B27-8D79-4F68-ADDC-129829C87CD0}
AppName=JumpSwitch
AppVerName=JumpSwitch v0.01.01
AppPublisher=MJP
DefaultDirName={pf}\JumpSwitch
DefaultGroupName=JumpSwitch
AllowNoIcons=yes
OutputDir=C:\Users\MJP\Documents\Dev\JumpSwitch\JSSetup
OutputBaseFilename=JSSetup
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "..\bin\x86\Release\*"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\bin\x86\Release\Content\*"; DestDir: "{app}\Content\"; Flags: ignoreversion
Source: "..\bin\x86\Release\Content\Effects\*"; DestDir: "{app}\Content\Effects\"; Flags: ignoreversion
Source: "..\bin\x86\Release\Content\Fonts\*"; DestDir: "{app}\Content\Fonts\"; Flags: ignoreversion
Source: "..\bin\x86\Release\Content\Levels\*"; DestDir: "{app}\Content\Levels\"; Flags: ignoreversion
Source: "..\bin\x86\Release\Content\Models\*"; DestDir: "{app}\Content\Models\"; Flags: ignoreversion
Source: "dotnetfx.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "vcredist_x86.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "dxwebsetup.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "xnafx20_redist.msi"; DestDir: "{app}"; AfterInstall: AfterXnaInstall(); Flags: ignoreversion


; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\JumpSwitch"; Filename: "{app}\JumpSwitchPC.exe"; WorkingDir: "{app}"
Name: "{group}\JSMapEditor"; Filename: "{app}\JSMapEditor.exe"; WorkingDir: "{app}"
Name: "{group}\{cm:UninstallProgram,JumpSwitch}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\JumpSwitch"; Filename: "{app}\JumpSwitchPC.exe"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\JumpSwitch"; Filename: "{app}\JumpSwitchPC.exe"; Tasks: quicklaunchicon



var
ErrorCode: Integer;

procedure AfterXnaInstall();
begin
ShellExec('', ExpandConstant('{app}\dotnetfx.exe'),'', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
ShellExec('', ExpandConstant('{app}\vcredist_x86.exe'),'', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
ShellExec('', ExpandConstant('{app}\dxwebsetup.exe'),'', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
ShellExec('', ExpandConstant('{app}\xnafx20_redist.msi'),'', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
end;



You'd just need to modify the file paths to point to where your content and binaries/executables are located (also for the XNA/DX/CRT/.NET installers if you don't keep them in the same folder as the setup script). And change the names and GUID too, of course. [wink]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!