Aaron Stebner's WebLog

Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio

Possible error when building a Silverlight application on a computer that does not have XNA Game Studio 4.0 installed

Possible error when building a Silverlight application on a computer that does not have XNA Game Studio 4.0 installed

Rate This
  • Comments 3

If you use the Windows Phone SDK 7.1, it is possible to get an error like the following when building a Silverlight project:

The target "GetCopyToOutputDirectoryContentProjectItems" does not exist in the project.

How to resolve this issue

In the cases that I’ve seen this error in the past, it was caused by XNA Game Studio 4.0 not being correctly installed on the computer.  If you encounter this error, I suggest trying one of the following:

  1. Repair or re-install the Windows Phone SDK 7.1, which will repair XNA Game Studio 4.0 behind the scenes.
  2. If #1 does not help, then you can use the cleanup tool described at http://blogs.msdn.com/astebner/pages/9544320.aspx to remove the Windows Phone SDK 7.1 and then re-install it.

More details about the root cause of the issue

The GetCopyToOutputDirectoryContentProjectItems target is defined in an MSBuild .targets file installed by XNA Game Studio 4.0.  In the Windows Phone SDK 7.1, one of the Silverlight .targets files has a dependency on this XNA Game Studio 4.0 build target in order to support building the new combined Silverlight and XNA applications.  This dependency exists for standard Silverlight projects in addition to Silverlight and XNA application projects.  As a result, it is possible to get into a state where you cannot build a Silverlight project in the Windows Phone SDK 7.1 when XNA Game Studio 4.0 is not installed even if you are not using XNA Game Studio features in your Silverlight project.

  • In my case running a repair didn't work. Instead I installed the XNA Games Studio 4 Refresh (which was much quicker) just a 40MB download and install.

    See <a href="merill.net/.../a>

  • Hi Merill Fernando - Thanks for posting about your experience.  It looks like the blog comment editor broke your link, so here is a link for people who read this post in the future - merill.net/.../fixed-the-target-getcopytooutputdirectorycontentprojectitems-does-not-exist-in-the-project.

    I wanted to make a couple of comments about your experience:

    1.  Installing the standalone XNA Game Studio 4.0 Refresh is enough to fix this GetCopyToOutputDirectoryContentProjectItems error message if you are working with Silverlight projects.  However, if you intend to create XNA games for Windows Phone, you will need to repair the Windows Phone SDK 7.1 because it installs some components that are not available in the standalone XNA Game Studio 4.0 Refresh.

    2.  Repairing the Windows Phone SDK 7.1 will install the XNA Game Studio 4.0 Refresh behind the scenes along with some other components.  It will take a little longer, but I haven't seen a case yet where the repair didn't work.  I'm not sure how to explain why it didn't work on your computer.

  • Thanks Merill Fernando and Aaron Stebner. this resolved my problem.

Page 1 of 1 (3 items)
Leave a Comment
  • Please add 5 and 4 and type the answer here:
  • Post