Possible error when building a Silverlight application on a computer that does not have XNA Game Studio 4.0 installed
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:
- Repair or re-install the Windows Phone SDK 7.1, which will repair XNA Game Studio 4.0 behind the scenes.
- 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.