Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio
All postings are provided AS IS with no warranties, and confer no rights. Additionally, views expressed herein are my own and not those of my employer, Microsoft.
XNA Game Studio 4.0 supports the following editions of Visual Studio 2010: Visual Studio 2010 Professional and better, Visual C# 2010 Express, and Visual Studio 2010 Express for Windows Phone. However, as described in more detail in this blog post, XNA Game Studio 2010 does not support developing games for all platforms in all of these Visual Studio 2010 editions. There is a specific unsupported scenario that gives a pretty poor error message if you try it, and I want to describe it in a little more detail here in case anyone runs into it while using XNA Game Studio 4.0.
Description of the issue
You can create XNA Game Studio 4.0 Windows Phone game projects in Visual Studio 2010 Professional and better or Visual Studio 2010 Express for Windows Phone, but not in Visual C# 2010 Express. However, because the overall XNA Game Studio 4.0 project system supports Visual C# 2010 Express, you can open XNA Game Studio 4.0 Windows Phone game projects that were created elsewhere in Visual C# 2010 Express. If you do this, you can edit the phone game projects and build them with no errors. If you attempt to press F5 to deploy and debug a phone game, you will see an error like the following:
Unable to start debugging. An error occurred that usually indicates a corrupt installation (code 0x80040154). If the problem persists, repair your Visual Studio installation via 'Add or Remove Programs' in Control Panel.
Unable to start debugging.
An error occurred that usually indicates a corrupt installation (code 0x80040154). If the problem persists, repair your Visual Studio installation via 'Add or Remove Programs' in Control Panel.
Repairing Visual C# 2010 Express will not help in this scenario. There are certain components that are required for Windows Phone development that are only available in Visual Studio 2010 Professional and better or Visual Studio 2010 Express for Windows Phone, and as a result, you cannot deploy or debug Windows Phone game projects in Visual C# 2010 Express.
How to work around this issue
If you run into the above error, you will need to open your Windows Phone game project (.csproj) file in one of the supported Visual Studio 2010 editions and deploy and debug it from there instead.
A note about Silverlight Windows Phone projects
One other note about this scenario – if you attempt to open a Silverlight Windows Phone application project that was created elsewhere in Visual C# 2010 Express, you will see an error like the following and will not even be allowed to open it:
error : The project file 'C:\Users\myuser\Documents\Visual Studio 2010\Projects\WindowsPhoneApplication1\WindowsPhoneApplication1\WindowsPhoneApplication1.csproj' cannot be opened. The project type is not supported by this installation.
error : The project file 'C:\Users\myuser\Documents\Visual Studio 2010\Projects\WindowsPhoneApplication1\WindowsPhoneApplication1\WindowsPhoneApplication1.csproj' cannot be opened.
The project type is not supported by this installation.
This message error is more clear, and it prevents you from being able to edit or build the project as well, which helps reinforce the lack of support for Visual C# 2010 Express in a way that XNA Game Studio 4.0 does not. The reason that Silverlight projects are able to present more clear errors in this type of scenario is that the Silverlight Windows Phone project system does not support Visual C# 2010 Express at all, whereas the XNA Game Studio 4.0 project system supports Visual C# 2010 Express, but not for all types of game projects.
My colleague Michael Klucher posted some information on his blog today about an upcoming update that will be available soon for the XNA Game Studio Connect application. XNA Game Studio Connect is the component that you run on an Xbox 360 in order to deploy, debug, test and peer review Xbox 360 games created with XNA Game Studio.
After the release of Xbox LIVE Community Games last fall, we ran into a few issues where the behavior of the game when running in XNA Game Studio Connect didn't match the behavior after it is published and is run as a community game. As a result, there were a few scenarios that were not possible for the developer or peer reviewer to test before the game was published, and in some cases a game that appeared to run fine during peer review would crash after it was published.
The upcoming update to XNA Game Studio Connect is intended to make the experience of running the game during development and peer review more closely match the experience of running it after it is published. The update will be available in the next few weeks, and Michael includes more details about the changes that were made behind the scenes in his blog post so I encourage you to check that out as well.
As announced earlier today on Soma’s blog and Jason Zander’s blog, the Visual Studio 2010 and .NET Framework 4 release candidate builds are available for download (today if you are an MSDN subscriber and this Wednesday, February 10, 2010 for the general public). Here are links where you can find additional information and provide feedback to the product teams:
I’m a little late posting this information since the book was released at the end of December, 2010, but my co-workers Tom Miller and Dean Johnson wrote a book titled XNA Game Studio 4.0 Programming: Developing for Windows Phone 7 and Xbox 360, and one of my other co-workers, Shawn Hargreaves, wrote the foreword for the book.
You can find more information about the book at the following locations:
I got a copy of this book last week, and now I need to remember to go find Tom, Dean and Shawn and get them to autograph it.
Rob Mensching posted an item on his blog announcing the release of the WiX v3.6 beta. The key feature in WiX v3.6 is the Burn bootstrapper/chainer. To summarize Rob’s post, Burn includes the following features:
In addition, all known WiX core toolset bugs that were opened against WiX v3.5 or earlier have been fixed in the WiX v3.6 beta.
I encourage you to download the WiX v3.6 beta and give it a try if you get a chance.
As noted on the XNA Game Studio team blog today, the Xbox LIVE Indie Games publishing pipeline is now accepting XNA Game Studio 4.0 games in addition to XNA Game Studio 3.1 games. This was originally scheduled to be enabled last Friday, but it slipped out a few days due to a couple of last minute issues that we ran into at the end of last week. As a result, the 90 day window when you will still be able to submit XNA Game Studio 3.1 games has been moved out accordingly. The last day you will be able to submit an XNA Game Studio 3.1 game for Xbox LIVE Indie Games is Monday, February 7, 2011.
Please see the following locations for more information about supported versions of XNA Game Studio for Xbox LIVE Indie Games and Xbox 360:
As announced earlier today on the XNA Game Studio team blog, registration is now open for the Dream.Build.Play 2011 Challenge. Here is a quick summary of the key information about the Dream.Build.Play 2011 Challenge:
I encourage you to check out the Dream.Build.Play 2011 web site for more detailed information and to register for the contest.
As I noted in my previous blog post, the final versions of Visual Studio 2010 and the .NET Framework 4 have shipped. I wanted to also briefly note that the Windows Phone Developer Tools CTP that was released a month ago at the MIX10 conference is not compatible with the final version of VS 2010. You must continue using the VS 2010 release candidate build in order to use the Windows Phone Developer Tools CTP.
Charlie Kindel posted some information on the Windows Phone Developer Blog with options you can pursue in the meantime, and he also discusses the timing for an upcoming refresh of the Windows Phone Developer Tools that will work with the final release of VS 2010.
Rob Mensching posted an item on his blog today declaring WiX v3.5 complete. The final build number is 3.5.2519.0 and it can be downloaded from http://wix.codeplex.com/releases/view/60102.
Here are a few brief highlights of what is included in WiX v3.5:
Rob Mensching announced on his blog yesterday that the build that is likely to be the final build of WiX v3.5 is now available to download. The v3.5.2519 build contains a couple of targeted fixes for bugs reported since the 2nd escrow build was declared in December, and it will be the final build of WiX v3.5 if no ship-stopping bugs are found.
If you are using WiX to create Windows Installer packages for your products, I strongly encourage you to upgrade to this build of WiX v3.5 and help the WiX virtual team validate that this build is ready to be declared the final WiX v3.5 build. Here are a couple of links to help get you started:
Last fall, I wrote a blog post linking to some information about using Guide.IsTrialMode in an XNA Game Studio 4.0 game for Windows Phone. Since then, the XNA Game Studio team has updated the behavior of the Guide.IsTrialMode API to simulate the same performance characteristics during development that a game will experience when a game is downloaded from the Windows Phone Marketplace. This change is available in the Windows Phone update that was released this spring:
As a result of this behavior change, the following point in my previous blog post no longer applies:
The following points from my previous blog post still apply, and should be taken into account when implementing trial mode functionality in your game:
<update date="5/5/2011"> Added a clarifying note to recommend that the trial check be done in the Activated event handler. </update>
There was an item posted on the XNA Game Studio team blog today that I wanted to link to in order to raise visibility because it helps answer some questions that have been asked frequently since XNA Game Studio 4.0 shipped last month. The post is located at http://blogs.msdn.com/b/xna/archive/2010/10/12/xna-game-studio-4-0-submissions-for-xbox-live-indie-games.aspx, and it provides more detail about the timeframe when the Xbox LIVE Indie Games submission pipeline will start accepting games created with XNA Game Studio 4.0 and when it will stop accepting games created with XNA Game Studio 3.1.
Here is a summary of the information in that post:
If you are just getting started with an Xbox 360 game using XNA Game Studio or have a game in progress that you do not plan to be ready to publish on Xbox LIVE Indie Games by the end of this year, then we recommend starting with XNA Game Studio 4.0 or porting your game to XNA Game Studio 4.0 to prepare for the above changes to the Xbox LIVE Indie Game pipeline.
As always, stay tuned to the XNA Game Studio team blog and the App Hub site for future announcements about the final release date for XNA Game Studio Connect for XNA Game Studio 4.0 and the opening of the Xbox LIVE Indie Games pipeline for XNA Game Studio 4.0 games.
The Windows Phone SDK 7.1 includes a step to install the XNA Game Studio 4.0 Refresh. Behind the scenes, the XNA Game Studio 4.0 Refresh installer has logic to detect if the computer has the original version of XNA Game Studio 4.0 installed. If so, the XNA Game Studio 4.0 Refresh installer will automatically uninstall XNA Game Studio 4.0 because the refresh is a super-set of the original version and there is no need to have both installed at the same time.
However, there is an installation ordering issue that can end up causing problems. The original XNA Game Studio 4.0 installer does not have any knowledge about the refresh, so if you run the installer for the original version of XNA Game Studio 4.0 on a computer that already has the XNA Game Studio 4.0 Refresh installed, setup will run in repair mode and it will let you attempt to “repair” XNA Game Studio 4.0. If you do this, you will end up with a mixed and matched set of components from the original version of XNA Game Studio 4.0 and the XNA Game Studio 4.0 Refresh. Once a computer gets into this state, attempting to uninstall either one of the versions of XNA Game Studio will only partially remove it because some of the components are shared by both versions.
If you accidentally install the original version of XNA Game Studio 4.0 onto a computer that already has the XNA Game Studio 4.0 Refresh, here are some steps that will allow you to clean things up and get back to a consistent set of XNA Game Studio 4.0 components:
If you try the above steps and run into any installation problems, please go to %temp%\XNA Game Studio 4.0 Setup\Logs, zip all of your setup log files, upload the zip file to a file server (such as http://skydrive.live.com), and then post a comment on this blog post that includes a link that I can use to download your log files and take a closer look.
The Windows Phone SDK 8.0 supports XNA Windows Phone game projects that target Windows Phone OS 7.1. It does not support XNA Windows Phone game projects that target Windows Phone OS 7.0. However, it does not block you from trying to open XNA projects that target Windows Phone OS 7.0. Instead, it will allow you to open the projects and try to build them, and then you will see error messages about missing reference assemblies.
In order to open and use your XNA projects that target Windows Phone OS 7.0 in the Windows Phone SDK 8.0, you must first upgrade them to target Windows Phone OS 7.1. You can perform this upgrade in one of the following ways:
XNA Game Studio 4.0 and the XNA Framework 4.0 introduced several breaking API changes. They are described at a high-level in the documentation and some of them are described in more detail on Shawn Hargreaves’ blog. These breaking changes present challenges to developers when they try to upgrade their games from XNA Game Studio 3.0 or 3.1 to 4.0. XNA Game Studio 4.0 includes a built-in upgrade wizard that will upgrade 3.0 and 3.1 projects to 4.0, but the upgrade process only updates meta-data in the project files (such as .csproj and .contentproj). Like the upgrade wizards for other Visual Studio project types, it does not attempt to make any changes to the code in the projects. This is because it can be difficult to reliably tell what the intent is of a given piece of code, and in many cases there are multiple options that could be valid solutions for breaking changes.
Fortunately, someone recently posted a cheat sheet with more details to help map compile errors that can occur after upgrading a 3.0 or 3.1 game to 4.0 to the options that you have to update your code so it will compile successfully with 4.0. If you are running into any issues fixing your game to react to breaking changes in XNA Game Studio 4.0, I encourage you to take a look at the cheat sheet at http://www.nelxon.com/blog/xna-3-1-to-xna-4-0-cheatsheet/.
As announced earlier today on the Windows Phone Developer Blog, the Windows Phone SDK update for Windows Phone 7.8 has been released. The Windows Phone SDK update for Windows Phone 7.8 is a patch and not a standalone product, so you must install the Windows Phone SDK 7.1 or the Windows Phone SDK 8.0 before you can install this update. Here is some information to help you get started installing and using the Windows Phone SDK update for Windows Phone 7.8:
What’s new in the Window Phone SDK update for Windows Phone 7.8:
Download and getting started links for the Windows Phone SDK update for Windows Phone 7.8:
As announced this morning on the XNA Game Studio team blog, there is a new game development landing page and a new game development tutorial available on the App Hub site. Here is some information about each of these new pages.
Game Development Landing Page
The landing page is available at http://create.msdn.com/education/gamedevelopment. It includes the following types of information:
Game Development Tutorial
The tutorial is available at http://create.msdn.com/education/tutorial/2dgame/getting_started. It includes a video and a code guide that present the key concepts to teach game design, art, and programming skills.
The XNA Game Studio components that are installed as a part of the Windows Phone SDK 8.0 have a setup bug that causes the uninstall process for the Windows Phone SDK 8.0 to break XNA Game Studio 4.0 and vice versa.
How to fix XNA Game Studio 4.0 if you uninstall the Windows Phone SDK 8.0
If you have both the Windows Phone SDK 8.0 and XNA Game Studio 4.0 installed and then uninstall the Windows Phone SDK 8.0, you will need to do the following to restore XNA Game Studio 4.0 functionality:
How to fix the Windows Phone SDK 8.0 if you uninstall XNA Game Studio 4.0
If you have both the Windows Phone SDK 8.0 and XNA Game Studio 4.0 installed and then uninstall the XNA Framework Redistributable 4.0 component that is installed as a part of XNA Game Studio 4.0, you will need to repair the Windows Phone SDK 8.0 to restore XNA Game Studio functionality in the Windows Phone SDK 8.0.
There are some known compatibility issues between .NET Framework 4 and 4.5 setup and .NET Framework 1.0 setup. As a result, installing the .NET Framework 4 or 4.5 will set a registry key that prevents .NET Framework 1.0 setup from running afterwards. That means that if you need to install both the .NET Framework 1.0 and 4 or 4.5 on the same computer, you need to install the .NET Framework 1.0 first, then install the .NET Framework 4 or 4.5.
I ran into a similar issue recently that I want to highlight as well because I didn’t find any official documentation about this behavior. The registry key set by .NET Framework 4 and 4.5 setup will also prevent .NET Framework 1.0 service packs from running afterwards, even if you already have the .NET Framework 1.0 installed. That means that if you need to install any .NET Framework 1.0 service packs and you have the .NET Framework 4 or 4.5 installed, you will need to do the following:
Behind the scenes, .NET Framework 1.0 setup includes a block that is implemented as a Type 19 custom action. This custom action is sequenced so that it runs during initial install and repair. Installing a service pack does the equivalent of a repair, which is why the block is triggered during service pack installation too.
As noted on the XNA Game Studio team blog and this App Hub news item, the deadline for submitting Xbox LIVE Indie Games created with XNA Game Studio 3.1 to play-testing or peer review is only one week away. Here are the key things to keep in mind:
Every once in a while, I see an email or a post on the forums from a developer who has created a game and wants to explore options for publishing it as an Xbox LIVE Arcade game or an Xbox LIVE-enabled game for Windows Phone, or Windows. There is a forum FAQ that we have been maintaining that contains some getting started links that will hopefully help developers who are interesting in learning more about this process. You can find the FAQ item at http://xboxforums.create.msdn.com/forums/t/3290.aspx.
In that FAQ, there are several links with more information about the Xbox LIVE Arcade program, the game submission process, and developing and submitting game pitches. Here are a few of the most useful getting started links:
Someone recently asked me a question about the unversioned file replacement scenarios that I wrote about a while ago in this blog post. The scenario that they described to me is similar to one that we faced when building the installer for the XNA Game Studio components that ship in the Windows Phone SDK 8.0, so I wanted to provide an overview of our problem and the solution we implemented in case it is useful to anyone else.
The problem we faced was that version B of our product (the XNA components in the Windows Phone SDK 8.0) upgrades several components that are shared by version A (the XNA Game Studio 4.0 Refresh). One of the components is an MSBuild .targets file, which is an unversioned file. Version B ships a version of the .targets file that is backwards compatible with Version A, so we wanted the installer for version B to overwrite the .targets file if a user installs version A and then version B. However, we did not want the installer for version A to overwrite (and downgrade) the .targets file if a user installs version B and then version A.
In order to prevent Windows Installer from overwriting this unversioned file, the last modified time had to be different than the creation time (as documented here). This feels a bit dirty, but we ended up solving this problem by implementing a custom action in version B of our product to call the SetFileTime function to update the last modified time of the .targets file after installing it. This causes version A of our product to not overwrite the file if a user installs version B and then version A. The .targets file is in its own Windows Installer component, which is reference counted by Windows Installer so that the .targets file is left behind after uninstalling either version of the product. Since we designed version B of the .targets file to be backwards compatible, it would continue to work even if a user installs version B, installs version A, and then uninstalls version B (which leaves them with version A of the product installed but version B of the .targets file installed).