Assembly references in XNA Game Studio 4.0 beta projects need to be updated after installing the final release

Since we released the final version of the Windows Phone Developer Tools and XNA Game Studio 4.0, I’ve heard from a few people who were using the beta version of the tools, upgraded to the final release, and ran into errors when compiling their XNA Game Studio 4.0 projects.  I want to describe the errors, the root cause and the fix in more detail in case anyone runs into this in the future.

Description of this issue:

After upgrading from the beta to the final release, some XNA Game Studio 4.0 projects created with the beta may fail to compile with errors like the following:

Could not resolve this reference. Could not locate the assembly "Microsoft.Xna.Framework.Content.Pipeline.EffectImporter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

There was a breaking change in XNA Game Studio 4.0 between the beta and RTW that will require you to update any projects that you created with pre-release builds of the tools.  There is a note about this issue in the Breaking Changes for Windows Phone Developer Tools from Beta to RTM section of the release notes, but it is pretty easy to miss, and it doesn’t include searchable text that includes the exact error message:

The public key token for XNA Framework assemblies has changed. Assembly references in content projects and game projects created using previous releases of Windows Phone Developer Tools must be updated to work correctly. You can do this by removing and re-adding references that do not resolve correctly using the References node in the Visual Studio Solution Explorer.

The XNA Framework public key token value changed from 6d5c3888ef60e27d to 842cf8be1de50553 in the final release of XNA Game Studio 4.0.  This causes assembly references to XNA Framework assemblies in projects created before this change to no longer resolve correctly once you update to the final release of XNA Game Studio 4.0.

How to resolve this issue:

You can use the following specific steps to resolve this issue if you run into it for XNA Game Studio 4.0 projects created with pre-release builds of the tools:

  1. Go to the Visual Studio solution explorer
  2. Expand the References node for your game project(s) and content project(s)
  3. For any XNA Framework assembly references that do not resolve correctly, delete them by right-clicking and choosing Remove or just by pressing the Del key
  4. Right-click on the References node, choose Add Reference... and re-add any references that you removed in step 3

References that do not resolve correctly will show up with a little yellow and black exclamation mark next to them like the content pipeline assemblies referenced by the content project in this example: