共用方式為


Upgrading Projects to XNA Game Studio 4.0

XNA Game Studio 3.0 or XNA Game Studio 3.1 game projects must be upgraded to target XNA Game Studio 4.0 for development in Microsoft Visual Studio 2010 and XNA Game Studio 4.0 Refresh. This upgrade is necessary in every case, regardless of the complexity or simplicity of the project.

Upgrading Your Projects

Projects created in XNA Game Studio 3.0 or XNA Game Studio 3.1 must be upgraded to work with Microsoft Visual Studio 2010 and XNA Game Studio 4.0.

The Project Upgrade Wizard for XNA Game Studio 4.0 executes automatically whenever you open a project or solution in Microsoft Visual Studio 2010 that was created for XNA Game Studio 3.0 or XNA Game Studio 3.1. The instructions provided by the Project Upgrade Wizard will lead you through the upgrade process.

The Project Upgrade Wizard only upgrades projects so that their structure is compatible with XNA Game Studio 4.0 and Visual Studio 2010. Your game code may still require further updates to comply with changes in the API for XNA Game Studio 4.0. The upgrade wizard does not change your code.

The chief tasks that the Project Upgrade Wizard performs are:

  • Updates XNA Framework references and properties from XNA Framework 3.0/3.1 to XNA Framework 4.0.
  • Updates the import targets file references in the game project for what is required for XNA Framework 4.0.
  • Updates the import targets file references in the content project for what is required for XNA Framework 4.0.
  • Relocates content folders from within game projects to their own content projects, and updates the code project's content references to the new content project.
  • Establishes the Game Profile and C# version settings for each game project according to the platform defaults.

Additional Notes for Windows Applications

When using the Project Upgrade Wizard to upgrade a project from XNA Game Studio 3.0 or XNA Game Studio 3.1 to XNA Game Studio 4.0, ClickOnce publishing will not work correctly. This happens because the prerequisites for the game still include older versions of the .NET Framework and XNA Framework redistributable that were needed by XNA Game Studio 3.0 and 3.1.

To work around this issue, additional steps are needed after upgrading your project with the Project Upgrade Wizard.

To fix ClickOnce publishing after using the Project Upgrade Wizard

  1. Right-click the project in Visual Studio's Solution Explorer, and choose Properties.
  2. Click on the Publish tab on the left side of the Properties window.
  3. Click the Prerequisites button. This will bring up a new dialog.
  4. In the Prerequisites dialog, check Microsoft .NET Framework 4 Client Profile (x86 and x64). Uncheck any other .NET Framework versions that are currently checked.
  5. In the Prerequisites dialog, uncheck Microsoft XNA Framework Redistributable 3.1.
  6. Save your project.

After following this procedure, you will be able to publish your project to create a ClickOnce package and setup.exe bootstrapper for it, as before.

See Also

What's New in XNA Game Studio 4.0 Refresh
Migrating from Zune to Windows Phone
Distributing Your Finished Windows Game