View Deploying XNA Games
These are my working notes, figuring out how the XNA Installation process works. There is nothing definitive here yet, so use at your own risk.
So according to Sharing and Distributing Your Game on the XNA Developer Center website, you need to use something called XNA Game Studio Package Utility (xnapack.exe) for both Windows and Xbox 360. However, this usable only by other XNA Game Studio users.
If it's a Windows-only game, you have more options by distributing the game files with the "redistributables". We're directed to the Distributing Your Finished Game article. From the article:
Approach 1: Compile Game Binaries for Distribution
- In XNA Game Studio, Build Solution
- Package all the files from the output directory using an "installation package tool" of your choice.
In practical terms, you go to the "Release" directory for your game, and copy both the Content directory and the executable. The next trick is to make sure you have all those darn prerequisites installed. You can see a list of prerequisite components and their installer locations. Unfortunately, Microsoft doesn't make it particularly EASY to automatically run and install these things. There are a bunch of installer options available...I'm looking at Windows Installer, WiX 3.0 and Votive (a VisStudio add-on that allows you to create Wix projects), Inno Setup, and Nullsoft Installer System (NSIS).
Here's what you need to ensure is installed:
- .NET Framework 2.0 Redistributable
- XNA Framework Redistributable
- Several files form the DirectX 9.0c Redistributable:
- OCT2006_d3dx9_31_x86.cab
- APR2007_d3dx9_33_x86.cab
- aug2007_xact_x86.cab
- APR2007_xinput_x86.cab
- DSETUP.dll
- dsetup32.dll
- DXSETUP.exe
- dxupdate.cab
This doesn't seem particularly elegant, or complete. We have also been getting this complaints about manifest files, so we need to know a bit more about what constitutes a "output" from the solution.
This article Build a setup project for your XNA Game has some background information about the overall process. From what I gather, you can create a "Setup Project" in Visual Studio 2005 (it's in the "other" project types). By choosing "Project Properties" for the Setup project in the Solution Explorer (right click for the menu), you can create a "Dependencies" list.
The Stubbs article describes how to create the "XNA Framework Prequisites" files you need. They are two XML files called product.xml and package.xml. This is a one-time thing. These files are [described here][manifests. There's also some general background in [this article series about the installer architecture][arch].
First, in
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\PackagesI'm creating anXNAFrameworks2folder. Then, create anen(English) language folder. We'll create our localizedpackage.xmlandproduct.xmlfiles in there. I copied them from the stubbs article.However, I'm using XNA 2.0, so I want to update the various product codes. I'm not sure it's strictly necessary, but I'd rather be sure while learning how these manifest things work.
ALternatively, this thread by pelleator describes using Inno to create an installer. I'll look at the stubbs approach first, which using Microsoft Windows Installer.
Product.XML
- Change
Product:ProductCodeto anything you want...I think it just has to be unique within Vis Studio. I used Microsoft.XNARuntime.2.0. Seems logical. - The list of distributable files is in the
` tag. The attributeNamerefers to the name of the installer file. TheHomeSitevalue refers to a String entry in thePackage.XMLfile.PublicKey` can be retrieved by looking at the Properties->Digital Signatures->Public Key field, copying the values out of that, and removing all the spaces. It seems to match. - The next set of tags,
<InstallChecks>, sets Properties if it can find that these specific Products are installed. These are used in the next set of tags. The pertinent redistributable product codes can be found in the Distributing Your Finished Game page at Microsoft. - The part of the file that actually says what to do is in
<Commands>, which contains individual command nuggets. Each command tag specifies what to do, and when to bypass.
...
Hmm, taking a quick look at other approaches.
Other Approaches
- Using NSIS to create setups for XNA Games - NSIS is the Nullsoft Installer. Promising.
- The DotNET module for downloading and installing the .NET framework...worked with NSIS.
- Using WIX for XNA-based games - This apparently requires something called SharpDevelop, which is an open-source IDE for .NET or something. This Wix 2.0 Tutorial is pretty informative and well done. More on wix from astebner as why GS2 switched to beta version 3.
- this page allegedly has code to check for requirements but is down. From this post
- Looking at Votive, which apparently allows you to load wix projects into Visual Studio Standard or higher.
