Distributing Your Finished Windows Game
|Platform||Source Code Visible||Format||Windows User Requirements|
|Windows||No||Setup.exe and manifest, or .zip or other compressed format||
Games for Windows - LIVE is not available to finished games. This functionality is not included in the redistributable version of the XNA Framework, and 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 only supported 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 Publishing
- You can use the ClickOnce publishing feature of Visual Studio to build and create an installation package for your XNA Game Studio game. This method will automatically ensure 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 Publishing
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 you wish to publish.
From the Build menu, click Publish.
The Publish Wizard appears.
In the Where do you want to publish the application? page, enter the file path or FTP location where the application will be published.
The default location is a folder named "publish" beneath the project's folder.
- Click Next to continue.
- In the How will users install the application? page, select the From a CD-ROM or DVD-ROM option if that is your choice (the default), and then click Next to continue.
In the Where will the application check for updates? page, choose 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, Web site, 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 publish the application.
Visual Studio builds your XNA Game Studio game project and, if successful, publishes 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 publishing 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 publishing is through the Publish properties of the Project Designer. These can be accessed by double-clicking the Properties item in Solution Explorer or by clicking [project name] Properties on the Project menu. Then click the Publish tab. This tab provides the facility to set several additional publishing options, including the version number of the published 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 the CD-ROM or DVD-ROM media.
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 not be accesible to your game through conventional storage APIs. The recommended actions to correct this are as follows:
- Ensure that 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
- Double-click the Properties item of your project in Solution Explorer.
- 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 publishing, 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.
From 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 .NET Framework 3.5 Redistributable.
Tip You can verify that your game was built with the XNA Framework 3.0 by loading your project in XNA Game Studio, and 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 3.0.
Redistributable Version Corresponding To... Product Code XNA Game Studio 3.0 3898934B-05AE-41CD-96BE-70DA9BFBCE1F
An alternative to checking the product code for the version of the XNA Framework Redistributable for XNA Game Studio 3.0 is to check the registry for the following value:
The following files from the DirectX 9.0c Redistributable.
These files are installed automatically as part of the XNA Framework Redistributable install package for XNA Game Studio 3.0. You don't need to follow a separate install step when you create games with that version of XNA Game Studio.