XNA Game Studio 4.0 in Visual Studio 2012 (including Express)

XNA Game Studio 4.0 in Visual Studio 2012 (including Express)

Visual Studio 2012 (VS 2012) is out, but Microsoft hasn’t updated XNA Game Studio (XNA) to work with their latest IDE. If you’re an XNA developer eager to upgrade, this is a bit of a problem. There’s good news, though: it’s really not that difficult to get XNA 4.0 working in VS 2012.

Over at Stack Overflow, in response to the question “How to install XNA game studio on Visual Studio 2012?”, members Steve B and Rick Martin seem to have figured out all of the necessary steps. The steps below are my attempt to “formalize” their contributions and offer a little more detail.

Before anything else, it’s important to note that for the following steps to work, XNA 4.0 must already be installed, which requires Visual Studio 2010 (VS 2010). Also, make sure VS 2012 isn’t running, just in case.

(Note: If you’re using Visual Studio Express 2012, follow these steps.)

  1. Copy the XNA extension from VS 2010 to VS 2012.
    1. Open a Command Prompt as administrator.
    2. Run the following command (adjust paths accordingly):
      xcopy /e "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\XNA Game Studio 4.0" "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\XNA Game Studio 4.0"
    3. When asked “Does [destination] specify a file name or directory name on the target (F = file, D = directory)?” answer with “D”.
    4. Leave the Command Prompt open for Step 4.
  2. Update the XNA extension’s supported Visual Studio version to 11.0 (VS 2012).
    1. Open your favorite text editor as administrator.
    2. In your text editor, open the extension.vsixmanifest file found in the newly copied directory.
    3. Locate the following line and change the “10.0” to “11.0”:
      <VisualStudio Version="10.0">
    4. Save the file.
  3. Clear VS 2012′s extension cache.
    1. In Explorer, navigate to %LocalAppData%\Microsoft\VisualStudio\11.0\Extensions.
    2. Delete any extensionSdks.*.cache and extensions.*.cache files, where “*” represents your culture (in my case, “en-US”). These files will be recreated the next time you start VS 2012.
  4. Force VS 2012 to “install” the XNA extension.
    1. Run the following command in the Command Prompt window from Step 1 (adjust paths accordingly):
      "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe" /setup

Visual Studio Express 2012 (VSE 2012)

These instructions are based on Jacob Raihle’s modifications to the original instructions.

  1. Copy the XNA extension from VS 2010 to VSE 2012.
    1. Open a Command Prompt as administrator.
    2. Run the following command (adjust paths accordingly):
      xcopy /e "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\XNA Game Studio 4.0" "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\WDExpressExtensions\Microsoft\XNA Game Studio 4.0"
    3. When asked “Does [destination] specify a file name or directory name on the target (F = file, D = directory)?” answer with “D”.
    4. Leave the Command Prompt open for Step 4.
  2. Update the XNA extension’s supported Visual Studio version to 11.0 (VSE 2012).
    1. Open your favorite text editor as administrator.
    2. In your text editor, open the extension.vsixmanifest file found in the newly copied directory.
    3. Locate the following line and change the “10.0” to “11.0”:
      <VisualStudio Version="10.0">
    4. Below that line, add the following line:
      <Edition>WDExpress</Edition>
    5. Save the file.
  3. Clear VSE 2012′s extension cache.
    1. In Explorer, navigate to %LocalAppData%\Microsoft\WDExpress\11.0\Extensions.
    2. Delete any extensionSdks.*.cache and extensions.*.cache files, where “*” represents your culture (in my case, “en-US”). These files will be recreated the next time you start VSE 2012.
  4. Force VSE 2012 to “install” the XNA extension.
    1. Run the following command in the Command Prompt window from Step 1 (adjust paths accordingly):
      "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\WDExpress.exe" /setup

And that’s it. You should now be able to create new XNA Game Studio 4.0 projects and work with existing XNA 4.0 projects.

Other Links

Updates

  • May 3, 2013: Added a second set of instructions specific to the Express version of Visual Studio.
  • October 7, 2012: Added Step 5 from Steve B’s Stack Overflow answer as Step 4 above.