Creating a Windows Phone Game or Library Project
Describes how XNA Game Studio includes a set of project templates that will help you to develop game projects for Windows Phone using the XNA Framework.
Note
The Windows Phone project templates for XNA Game Studio 4.0 Refresh are available only after the Microsoft Windows Phone SDK has been installed.
- Before you begin: choosing a Windows Phone operating system (OS) version
- Starting a New Project
- Windows Phone Game (4.0)
- Windows Phone Game Library (4.0)
- Windows Phone Silverlight and XNA Application
Before you begin: choosing a Windows Phone operating system (OS) version
When creating a new XNA Game Studio project for Windows Phone, you can choose between the original version of the Windows Phone OS (Windows Phone OS 7.0) or the latest version (Windows Phone OS 7.1).
Certain Windows Phone features are only available to your game if you choose Windows Phone OS 7.1. However, your game will not run on phones equipped with Windows Phone OS 7.0.
In general, you should target the earliest version of the Windows Phone OS that provides all of the features needed by your game, to allow it to run on the widest range of devices. If you later decide that you want to target the latest version, you can upgrade your project using the procedures in Upgrading an existing XNA Windows Phone Project to Windows Phone OS 7.1.
Starting a New Project
To start a new project
To begin a new Windows Phone project, click File, and then click New Project.
You’ll be presented with a dialog that lists a number of project templates.
XNA Game Studio provides template types for XNA Framework game development in the XNA Game Studio 4.0 Refresh section of the Visual C# project types. The templates offered for developing XNA Framework games for Windows Phone are:
- Windows Phone Game (4.0)—A project for creating an XNA Framework 4.0 game application for Windows Phone.
- Windows Phone Game Library (4.0)—A project for creating an XNA Framework 4.0 game library for Windows Phone.
- Windows Phone Silverlight and XNA Application—A project for creating a Windows Phone Silverlight Application capable of rendering graphics using the XNA Framework.
- Content Pipeline Extension Library (4.0)—A project for creating an XNA Framework 4.0 Content Pipeline Extension Library. For more information, see Creating a Windows Game or Library Project.
For information about XNA Game Studio project templates for Windows or Xbox 360, see Creating a Windows Game or Library Project and Creating an Xbox 360 Game or Library Project.
Windows Phone Game (4.0)
XNA Game Studio provides a Windows Phone Game template that creates and loads a set of starter files. This new project contains basic code that renders a colored background.
To create a Windows Phone Game (4.0) project
From the File menu, click New Project.
Select the Windows Phone Game (4.0) project type.
Type the name for the game project in the Name text box.
You can also modify the default values for the Location and Solution Name controls.
Click OK.
You'll be presented by a dialog that requires you to choose a version of the Windows Phone to target:
Choose the Windows Phone Operating System version and click OK.
Your new game project will be created and loaded in Microsoft Visual Studio.
Results
The new starter project contains the following important features.
References
References to the following assemblies are added automatically to a new Windows Phone Game project:
- Microsoft.Xna.Framework
- Microsoft.Xna.Framework.Game
- Microsoft.Xna.Framework.GamerServices
- Microsoft.Xna.Framework.Graphics
- Microsoft.Xna.Framework.Input.Touch
- mscorlib
- System
- System.Core
- System.Net
- System.Xml
- System.Xml.Linq
In addition to these standard assemblies, you can add other assemblies as needed for your project.
Windows Phone Game Library (4.0)
XNA Game Studio provides a Windows Phone Game Library (4.0) template that creates and loads a set of starter files. Typically, projects of this type contain managed classes that implement basic or advanced features used by a game engine. Once completed, these class libraries can be referenced by other Windows Phone projects. Also, they provide common functionality without having that code reside within the game project.
The new project contains basic code that implements an empty library, usable by other Windows Phone Game projects or Windows Phone Game libraries.
Results
The new starter project contains the following important features.
Project Properties
These properties control many aspects of your current project. Some examples include general application settings, debug settings, and additional project resources. You can use the Project Designer to modify the values for these properties.
In addition to these properties, assembly information (such as the library title) is stored in the AssemblyInfo.cs file. You can use the Assembly Information dialog box to modify this information, or you can manually edit the .cs file.
References
References to the following assemblies are added automatically to a new Windows Phone Game Library project:
- Microsoft.Xna.Framework
- Microsoft.Xna.Framework.Game
- Microsoft.Xna.Framework.GamerServices
- Microsoft.Xna.Framework.Graphics
- Microsoft.Xna.Framework.Input.Touch
- mscorlib
- System
- System.Core
- System.Net
- System.Xml
- System.Xml.Linq
In addition to these standard assemblies, you can add other assemblies as needed for your project.
Content
The nested Content project stores and builds content that is to be included in the game library. This is useful for including reusable content assets that support the classes and methods in the game library. For more information, see Game Content Project.
Class1.cs File
This file implements an empty C# class within a namespace. It provides a starting point for the class library.
To create a Windows Phone Game Library (4.0) project
From the File menu, click New Project.
Select the Windows Phone Game Library (4.0) project type.
Type the name for the library project in the Name text box.
You can also modify the default values for the Location and Solution Name controls.
Click OK to create and load the new project.
Windows Phone Silverlight and XNA Application
XNA Game Studio provides a Windows Phone Silverlight and XNA Application template that creates and loads a set of starter files for a Silverlight application capable of rendering graphics using the XNA Framework. This new project contains basic code that renders a colored background. For additional information on using the XNA Framework to render graphics in a Silverlight application see Adding XNA Rendering to a Silverlight Application on Windows Phone.
To create a Windows Phone Silverlight and XNA Application project
From the File menu, click New Project.
Select the Windows Phone Silverlight and XNA Application project type.
Type the name for the game project in the Name text box.
You can also modify the default values for the Location and Solution Name controls.
Click OK to create and load the new project.
Results
The new starter project contains the following important features.
References
References to the following assemblies are added automatically to a new Windows Phone Silverlight and XNA Application project:
- Microsoft.Phone
- Microsoft.Phone.Interop
- Microsoft.Xna.Framework
- Microsoft.Xna.Framework.Game
- Microsoft.Xna.Framework.Graphics
- Microsoft.Xna.Framework.Input.Touch
- Microsoft.Xna.Framework.Interop
- mscorlib
- system
- System.Core
- System.Net
- System.Windows
- System.Xml
In addition to these standard assemblies, you can add other assemblies as needed for your project.
See Also
Upgrading an existing XNA Windows Phone Project to Windows Phone OS 7.1
Developing Xbox 360 Games
Creating a Windows Game or Library Project