How to create a solution with XNA Game Studio 4.0 Windows Phone 7.0 and 7.1 projects
The Windows Phone Developer Tools 7.1 allows you to create applications and games that target both Windows Phone OS 7.0 and Windows Phone OS 7.1. In some cases, you may want to create separate versions of an application or game that target both versions of the Windows Phone OS and that share common code. There is not a way to automatically create a Visual Studio solution and projects to do that. Here are some manual steps you can use to create XNA Game Studio 4.0 projects that target Windows Phone 7.0 and 7.1 and that share code and content:
- Create a new XNA Game Studio 4.0 Windows Phone game project that targets Windows Phone OS 7.0.
- Close the solution.
- Create a new XNA Game Studio 4.0 Windows Phone game project that targets Windows Phone OS 7.1.
- Close the solution.
- Copy the project file from step 3 above into the same directory as the project from step 1.
- Update the RootNamespace and AssemblyName values in the project from step 3 to match the values in the project from step 1.
- Update the OutputPath values for each build configuration in the projects from step 1 and step 3 so that each project will build to unique output locations.
- Update the content reference in the project from step 3 to point to the same content project as the project from step 1.
- If needed, add a new value to the DefineConstants list in the projects from step 1 and step 3 so that you can IFDEF code to compile only for the Windows Phone 7.0 and/or Windows Phone 7.1 project.
- Update the solution (.sln) file from step 1 to include the project from step 3.
You can find a sample solution that I created that I have already completed all of the above steps for at https://cid-27e6a35d1a492af7.skydrive.live.com/self.aspx/Blog_Tools/WPGameMultiTargetingSample.zip.
The above steps will create a solution and a set of projects that behave differently than a traditional multi-platform solution in XNA Game Studio that is created by starting a project for one platform and then creating a copy of it for another platform via the Create Copy of Project menu item in the Visual Studio IDE. Projects created with Create Copy of Project will be automatically synchronized behind the scenes so that if you add, remove or rename a file in one project, it is reflected in the other copies. After completing the above steps, you will need to make sure that you manually synchronize any file add, remove or rename operations. Changing code within files that have already been added to both projects will be picked up when you build either one of the projects though.