共用方式為


Confusing error when attempting to debug an XNA Game Studio 4.0 Windows Phone game in Visual C# 2010 Express

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.

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.

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.

Comments

  • Anonymous
    December 08, 2012
    Thanks!! This has been most annoying, you're a life saver.