Distributing Your Finished Windows Game
Presents information about how to share your game with any Windows user, even if the user does not have XNA Game Studio installed.
Quick Information
Platform | Source code visible | Format | Windows user requirements |
---|---|---|---|
Windows | No | Setup.exe and manifest, or .zip or other compressed format. |
|
Important
Games for Windows - LIVE is unavailable to finished games. This functionality is not included in the redistributable version of the XNA Framework. A game that attempts to use these components without XNA Game Studio installed will result in a GamerServicesNotAvailableException. Also, the XNA Framework Redistributable file does not contain the Content Pipeline Build Runtime. Building content at run time is supported only when XNA Game Studio has been installed on the Windows-based development computer.
If you would like to share your XNA Game Studio game with other Windows users, but do not want to share your source code and assets, you can create an installable package that contains your game binaries and the necessary redistributable files.
The ClickOnce publishing feature of Visual Studio provides a convenient way to produce a portable installation package for distribution on a CD, Web site, or other media.
Sharing with Another Windows User
You may package XNA Game Studio game projects for use without XNA Game Studio installed only for the Windows platform.
You can use one of the following methods to create a portable install package:
- Using ClickOnce Deployment
You can use the ClickOnce feature of Visual Studio to build and create an installation package for your XNA Game Studio game. This method automatically ensures that all required supporting files are included in your installation package. - Using Another Installation Package Tool
You can use an installation package tool of your choice. With this method, you must take more care to include all of the required supporting files for an XNA Game Studio game.
Using ClickOnce Deployment
ClickOnce is a deployment technology that allows you to create self-updating Windows-based applications that can be installed and run with minimal user interaction.
To build a ClickOnce installation package
In Solution Explorer, select the game project for the Windows platform to which you want to deploy.
On the Build menu, click Publish.
The Publish Wizard appears.
On the Where do you want to publish the application? page, enter the path or FTP location where the application will be deployed.
The default location is a folder named "publish" below the project's folder.
Click Next to continue.
On the How will users install the application? page, select the From a CD-ROM or DVD-ROM option (the default) if that is your choice, and then click Next to continue.
On the Where will the application check for updates? page, select an update option:
- If the application checks for updates, click The application will check for updates from the following location, and enter the location where updates will be posted. This can be a file location, website, or FTP Server.
- If the application will not check for updates, click The application will not check for updates.
- Click Next to continue.
Click Finish to deploy the application.
Visual Studio builds your XNA Game Studio game project and, if successful, deploys your application to the location specified in step 3. A Windows Explorer window then opens to show the Setup.exe file produced and the manifest.
The ClickOnce feature for XNA Game Studio automatically includes all of the required software packages as part of the installation package.
An alternate method of initiating ClickOnce is through the Publish properties of the Project Designer. These properties can be accessed by double-clicking the Properties item in Solution Explorer or by clicking [project name] Properties on the Project menu, and then clicking the Publish tab. This tab provides the facility to set several more options, including the version number of the deployed application.
If you wish to distribute your game on a CD, use a CD-Rewriter or DVD-Rewriter to copy the files from the specified location to a CD-ROM or DVD-ROM.
Special Considerations for Game Data Files
Your game may require the use of a data file to read and store information. For example, the starter kit provided with XNA Game Studio uses an XML file to read and store game settings. Other games may use a text file or other format.
The default behavior of the ClickOnce publishing wizard assigns any XML, text, or other data files in a project to "Data File" as its Publish Status. However, this status is for files containing data used by the installer package, not for files accessible to your game when it executes. Files assigned to this type will be placed in the path denoted in the .NET Framework's ApplicationDeployment.DataDirectory property.
This is likely to be inconvenient, as the file will be inaccessible to your game through conventional storage APIs. The recommended actions to correct this are as follows:
- Ensure the Build Action property of the data file is set to "Content." This specifies that the data file is to be included in the install package.
- Reassign the Publish Status to "Include."
The Build Type setting may be changed through the file's property window.
The Publish Status is changed through the Application Files dialog box of the Publish properties section of Project Designer.
To change the publish status
- In Solution Explorer, double-click the Properties item of your project.
- Navigate to the Publish tab in Project Designer.
- Click the Application Files button.
- Select the drop-down box in the Publish Status column of the dialog box to change the setting.
- Click OK.
Using Another Installation Package Tool
To use an installation package tool other than ClickOnce, you will need to build your game binaries and include the required software packages.
To compile your game binaries for distribution with another installation package tool
In XNA Game Studio, open the project you want to package.
On the Build menu, click Build Solution.
This creates the necessary files needed to run your game on other computers.
Using an installation package tool of your choice, package all files located in the appropriate output directory of your project.
Required Software Packages
In addition to the requirements listed in the previous table, there are additional software prerequisites that must be installed on a player's machine if the computer does not have XNA Game Studio installed.
The following software packages must be installed on the player's computer in order for your game to run.
The XNA Framework Redistributable 4.0 Refresh.
Tip
You can verify that your game was built with the XNA Framework 4.0 Refresh by loading your project in XNA Game Studio, and then by clicking the project node in Solution Explorer. The XNA Framework Version property is visible in the property pane.
To determine whether the player already has the redistributable installed, use the Windows Installer function MsiQueryProductState with the product code for the version of the redistributable that you want to verify. The following table lists the product code for the XNA Framework Redistributable 4.0 Refresh.
Redistributable version corresponding to Product code XNA Game Studio 4.0 Refresh 2BFC7AA0-544C-4E3A-8796-67F3BE655BE9 An alternative to checking the product code for the version of the XNA Framework Redistributable for XNA Game Studio 4.0 Refresh is to check the registry for the following value:
[HKEY_LOCAL_MACHINE\Software\Microsoft\XNA\Framework\v4.0 Refresh] Installed=1
The following files from the DirectX 9.0c Redistributable.
- Mar2009_d3dx9_41_x86.cab
- APR2007_d3dx9_33_x86.cab
- APR2007_xinput_x86.cab
- Feb2010_xact_x86.cab
- Feb2010_XAudio_x86.cab
- Feb2010_X3DAudio_x86.cab
- DSETUP.dll
- dsetup32.dll
- DXSETUP.exe
- dxupdate.cab
These files are installed automatically as part of the XNA Framework Redistributable install package for XNA Game Studio 4.0 Refresh. You do not need to perform a separate install step when you create games with this version of XNA Game Studio.
See Also
Sharing Your Source Code and Assets
Sharing Your Game Package