Deploying an Xbox 360 Game
Describes how XNA Game Studio can copy executable and media files to the Xbox 360 retail console once you are ready to deploy them. As you develop your Xbox 360 game, it is convenient to deploy your game executable to your console for testing purposes.
However, before deploying, you need to use the XNA Game Studio Device Center dialog box to establish a connection between the console and your computer. For a detailed explanation of this process, see Connecting to Your Xbox 360 with XNA Game Studio 4.0 Refresh.
|For more information about troubleshooting deployment to your console, see Troubleshooting Xbox 360 Game Deployment.|
Deploying Your Game
This procedure shows you how to deploy your Xbox 360 game from XNA Game Studio to a console. This assumes you established a connection between that console and your computer.
|An XNA Framework game deployed to the Xbox 360 console cannot exceed 2 GB. Also, this means that any single file you deploy must be smaller than 2 GB.|
To deploy your Xbox 360 game
Load an Xbox 360 Game project into XNA Game Studio.
Make sure the Output window is visible so you can follow the progress of your deployment in detail, and so you can tell where a problem occurred, if one does.
- To display the Output window, from the View menu, click Output, or press CTRL+W, and then press the letter O key.
From the Xbox 360 dashboard, go to the My Xbox menu, select Game Library, and press the A controller button.
Note Also, you have the option of using the Xbox 360 Guide: From the Games page, select Game Library, and press the A controller button.
- From the Game Library page, select Community Games on the Collections tab, and press the A controller button.
- Select XNA Game Studio Connect, and press the A controller button.
Select Launch, and press the A controller button.
The Waiting for computer connection page appears.
In XNA Game Studio, deploy the game by either right-clicking the solution name and then selecting Deploy Solution, or, from the Build menu, selecting Deploy Solution.
During this process, both the Output window of XNA Game Studio and the Connect to Computer screen show the deployment progress. You can view a list of the deployed files and some additional information.
Press B to return to the Game Library.
Your deployed game appears in the list of Recent Games.
Select the game you just deployed from this menu, and press the A controller button.
Choose Play Game, and press the A controller button again to start the game.
Incremental deployment is enabled automatically for XNA Game Studio projects. This means that the IDE tracks which files have been deployed already to your Xbox 360 console. Subsequently, it only deploys updated files. Also, if a file that was part of the previous deployment is no longer in the game, that file is deleted from the console during deployment. (This only applies to previously-deployed files, not to files that were generated on the console.) The output window reflects exactly what actions were taken during deployment.
A full deployment, which deletes any previous game files and copies the entire game to the console, is triggered by the following conditions:
- This is the first time the project has been deployed.
- A different configuration is used than in the last deployment to this device.
- The game was deleted from the Xbox 360 console since the last deployment.
- The solution has been cleaned since the last deployment. (For more information about cleaning the solution, see the "Cleaning the Solution Before You Build" section that follows.)
- The last deployment to the device was from a different source than the currently loaded solution, such as a copy on another Windows-based computer or a .ccgame package.
If you cancel during a deployment, some files may not have transferred. This leaves the game in an indeterminate state. The next incremental deployment will behave as if the last deployment never occurred. It will update the correct files on the Xbox 360 console.
Cleaning the Solution Before You Build
Cleaning your game solution before you build removes all intermediate and output files generated by the build. This forces the next build to regenerate everything.
If you select Rebuild on the Build menu, the build automatically regenerates everything, but you may also want to clean your solution before you do a build. This is particularly true if you are experiencing unexpected build errors.
In Microsoft Visual C# Express Edition, the Clean Solution option is not included in the Build menu by default. However, it is easy to add it if you want to make cleaning your solution convenient.
To add the Clean Solution option
- In XNA Game Studio, right-click the menu or toolbar at the top of the window, and click Customize.
In the Customize dialog box, click the Build menu (or any other menu where you want to add the command).
This opens the menu, and leaves it open.
From the Customize dialog box, click the Commands tab, and select Build from the Categories pane on the left.
From the Commands pane on the right, drag the Clean Solution command into the open Build menu, and then drop it where you want it.
- Close the dialog box.
Now, whenever you want to clean the solution, you can click Clean Solution from the menu where you added it.
Managing Several Xbox 360 Consoles with XNA Game Studio Device Center
Using the XNA Game Studio Device Center dialog box, XNA Game Studio supports deployment and debugging on multiple Xbox 360s.
The XNA Game Studio Device Center does the following:
- Creates connections between your Windows-based computer and each of your Xbox 360 console devices. If you have more than one Xbox 360, you can use XNA Game Studio Device Center to create connections between your Windows-based computer and each of your Xbox 360 console devices. Each connection allows you to deploy and debug XNA Framework 4.0 games to a specific Xbox 360 console device.
- Manages the list of available Xbox 360 console devices. This allows you to add and delete devices from the list of devices available for deployment.
- Allows you to set the default Xbox 360 console device to use for deployment. Similar to the default printer in Microsoft Windows, the default Xbox 360 console device is the device to which XNA Game Studio will deploy, unless you specifically select a different Xbox 360 console device for deployment. If there is only one Xbox 360 console device, it is set as the default device.
- Stores the list of Xbox 360 console devices on a per-user basis. Each user has a different list of Xbox 360 console devices to which he or she can deploy, and a different default device to use for deployment.
XNA Game Studio installs the XNA Game Studio Device Management Toolbar into Visual Studio. The XNA Game Studio Device Management Toolbar does the following:
- When you click the Launch XNA Game Studio Device Center button, provides easy access to the XNA Game Studio Device Center dialog box.
- Allows you to choose a specific Xbox 360 console device for deployment. Use the XNA Game Studio Deployment Device drop-down list. Also, do this if you want to deploy to a different Xbox 360 console device than your default device.
The XNA Game Studio Device Management Toolbar automatically appears within Visual Studio when an Xbox 360 Game project or Xbox 360 Library project is loaded in supported versions of Visual Studio tools.
|If your startup project is not an Xbox 360 or Windows Phone project, most of the toolbar buttons will be unavailable. To make these buttons available, change your startup project to an Xbox 360 Game or Library project.|
For more information about how to add Xbox 360 console devices to the XNA Game Studio Device Center dialog box, see Connecting to Your Xbox 360 with XNA Game Studio 4.0 Refresh. For more information about using the features of XNA Game Studio Device Center, see Using XNA Game Studio Device Center.
Managing Multiple Xbox 360 Deployments
As noted previously, XNA Game Studio Device Center gives you the option to choose a specific Xbox 360 console device for deployment. This enables you to deploy your game to multiple Xbox 360s. Also, this supports testing and debug of networked games.
If you want to execute the same game instance on all Xbox 360 consoles, you can deploy the same build to all consoles.
However, if you want to debug and modify one instance of the game while the game continues to execute on all other consoles, you can do this by using a unique configuration to build and deploy the instance you want to modify. This is an advanced scenario, but one that is common for debugging networked games.
If you are unable to deploy your Xbox 360 game successfully, see Troubleshooting Xbox 360 Game Deployment.