New Visual Studio features in the XNA Game Studio 3.0 beta – multiple content projects and cross-platform synchronization

There are a couple of new features that have been added in the XNA Game Studio 3.0 beta that are intended to improve the development experience in Visual Studio that I want to briefly introduce.  If you have a chance, I encourage you to download the XNA Game Studio 3.0 beta and give it a try.  Please let us know if you find any bugs or have any feedback about the features described below or any of the other features in the product by using the Connect site.

Multiple Content Projects

In XNA Game Studio 2.0, the concept of a content project was introduced.  However, each game project was limited to a single content project, which meant that sharing content between games required some additional work (such as creating a game library and including that library in each game project that you wanted to use the shared content in).

In XNA Game Studio 3.0, it is now possible to add and remove content projects directly within a game project.  This allows you to include multiple content projects into your game project.  You can do all of the following:

  1. Add a new content project - to do this, click on your game project in the Visual Studio solution explorer, then click on the Visual Studio Project menu and choose Add New Content Project...Alternatively, you can right-click on your game project in the solution explorer, choose Add, then New Content Project...You will be prompted to provide a unique name, and an additional content project node will be added to your game project.
  2. Add an existing content project - to do this, click on your game project in the Visual Studio solution explorer, then click on the Visual Studio Project menu and choose Add Existing Content Project...Alternatively, you can right-click on your game project in the solution explorer, choose Add, then Existing Content Project...You will be prompted to browse to the location of the .contentproj file that you want to add, and it will be added to your game project.  Note that each content project must have a unique name.
  3. Remove a content project - to do this, right-click on your content project in the Visual Studio solution explorer and choose Remove.

There are several possible uses for this feature.  Here are a couple of examples:

  • Creating a content project that contains assets that you intend to share across multiple games.  For example, you may have a set of terrain assets that you want to group together into a content project and then include in multiple games so they will have the same backgrounds and look-and-feel and so you can make changes to the assets in a central location.
  • More easily managing cross-platform projects that target Windows, Xbox 360 and Zune.  The Zune has a smaller screen resolution and more restrictive memory requirements (described in more detail here), so you could create a Zune-specific low resolution content project, a Windows + Xbox 360 high resolution content project, and a common shared content project in order to manage game assets in this type of scenario.  There is a topic in the XNA Game Studio 3.0 documentation that describes how to configure a cross-platform project in this way - it is located under XNA Game Studio 3.0 | Using XNA Game Studio | Developing Cross-Platform Games | How To: Create a Cross-Platform Game Solution in the help table of contents.

Cross-Platform Synchronization

XNA Game Studio has a feature that allows you to create a game project for one platform (Windows, Xbox 360 or Zune) and then create a copy of that project for one of the other supported platforms.  Behind the scenes, a new .csproj file is created to represent the game for the new platform, and the appropriate changes are made to the .csproj file so references, pre-processor definitions, etc will be configured correctly for the new platform.

When you create a copy of a project for another platform, it will automatically be populated with the same code and content that existed in the original project at the time the copy was made.  However, in previous versions of XNA Game Studio, any future additions, removals or renames to items in one of the projects would cause it to get out of sync with the other project.  Stephen Styrchak posted some information a while ago on his blog about an add-in he wrote to automatically synchronize cross-platform projects in XNA Game Studio 2.0.

Starting in the XNA Game Studio 3.0 beta, we have included built-in support for cross-platform synchronization that is similar to Stephen's add-in.  After creating a game project and then creating one or more cross-platform copies, XNA Game Studio 3.0 will automatically synchronize item additions and renames that occur in any of the projects in the cross-platform group.

It is important to note here that XNA Game Studio 3.0 will only synchronize projects that are in the same solution and are part of a "cross-platform group."  This means that the projects have to have been added to the solution by creating copies of an existing game project as opposed to by using the Add New Project or Add Existing Project options in Visual Studio.  You can tell whether or not 2 .csproj files are a part of the same cross-platform group by looking at the metadata in the project files.  Every XNA Game Studio project should have a property named <XnaCrossPlatformGroupID> that is set to a GUID value.  Projects that are a part of the same cross-platform group will have identical <XnaCrossPlatformGroupID> values in their .csproj files.

Comments (8)

  1. Bjoern Graf says:

    Something I have always wondered about (with my limited knowledge of the VS system): Why are the different platforms implemented as individual projects and not through the build configuration settings?

  2. Hi Bjorn – Essentially, there are things that we do differently based on the platform that the game project targets that it wasn’t possible for us to implement this purely via build configuration settings.  For example, there are certain IDE settings that are only applicable to Windows games (such as ClickOnce publishing or adding web references), there is platform-specific handling of reference assemblies, there is platform-specific deployment logic, etc.

  3. Bjoern Graf says:

    Ok, that makes sense for 2.0 and below and a change to utilize VS 2008’s multi-targetting thingy would have been to expensive, right? But then the VS.NET SDK is said to change tremendously with each version…

  4. Hi Bjorn – XNA Game Studio 3.0 does support the multi-targeting features in VS 2008, but only for Windows games.  For Windows, you can choose to target the desktop .NET Framework 2.0, 3.0 or 3.5 with your game.  For Xbox 360 and Zune, there is only one supported version of the .NET Compact Framework that ships in XNA Game Studio for each of these platforms, so there are not multiple version to target, and therefore multi-targeting is disabled for those platforms.

    There are some breaking changes in each version of the VS SDK, but for the most part, things are backwards compatible.

  5. Bjoern Graf says:

    With the multi-targeting feature support I meant to choose the different platforms (as in: replace the current one-project-per-platform-approach with this feature), not .NET versions – but then I do not really know much about it, esp. if it would be possible at all :]

  6. Hi Bjorn – The multi-targeting feature in VS 2008 is fairly limited and is specific to the .NET Framework versions 2.0, 3.0 and 3.5.  It isn’t extensible to the point that we’d be able to use it for XNA Game Studio project platforms.

  7. Last week, I posted some high-level details about a couple of new Visual Studio features that are available

Skip to main content