ClickOnce publishing does not work for an XNA Game Studio 4.0 Windows game upgraded from 3.0 or 3.1

A customer on the App Hub forums ran into an issue that I wanted to describe in more detail here in case anyone else runs into it in the future.  If you have a Windows game project created with XNA Game Studio 3.0 or 3.1 and upgrade it to XNA Game Studio 4.0, ClickOnce publishing will not work correctly.  This happens because the prerequisites for the game still include the older versions of the .NET Framework and the XNA Framework Redistributable that were needed by XNA Game Studio 3.0 or 3.1.

If you have upgraded a Windows game from XNA Game Studio 3.0 or 3.1 to 4.0 and want to be able to use the publish command to create a ClickOnce installer for it, you can use the following workaround:

  1. Open your XNA Game Studio 3.1 Windows game project in a supported VS 2010 edition (Professional, Premium, Ultimate, Visual C# 2010 Express, Visual Studio 2010 Express for Windows Phone)
  2. Follow the steps in the Visual Studio Conversion Wizard to upgrade the project to XNA Game Studio 4.0
  3. After upgrade is complete, update your game code to address any breaking changes between the XNA Framework 3.1 and 4.0
  4. Right-click on the project in the Visual Studio solution explorer and choose Properties
  5. Click on the Publish tab on the left side of the Properties window
  6. Click on the Prerequisites… button
  7. In the Prerequisites dialog, check the item named Microsoft .NET Framework 4 Client Profile (x86 and x64), uncheck any other .NET Framework versions that are currently checked, and uncheck the Microsoft XNA Framework Redistributable 3.1
  8. Save your project and publish your project to create a ClickOnce package and a setup.exe bootstrapper for it