As you already know, the Content Pipeline always executes locally in your Windows machine, to parse and process all the contents into the XNB files. If you don’t have this clear, I´d suggest you to read this Shawn Hargreaves blog post. The above error appears sometimes when you add in your Content Project a reference to a Windows Phone Game Library assembly, or to any other platform game library.
I say “sometimes” because this doesn't happen always. For example, it fails on my laptop, but not in my desktop machine (the first is Vista and second is 7, don’t know if that has anything to do with it).
The problem is that sometimes (especially since Content Projects where separated from regular projects), you need to reference the same assembly from both a Content Project and from a main game project. For instance, if you store in a extra assembly object proxies or descriptions to be used by the XML Intermediate Serializer, you will need them in both the Content Project (to make the serialization), and in the runtime game, to make the de-serialization.
So, if all of them are Windows-XNA based, no problem. But what happens when the main game project is a Windows Phone project? The scenario is:
As I said, if the Aux. Game Library is a Windows Phone game library, for example, it will give you the mentioned compiling problems if you reference it in the Content Project. And if it’s a Windows game library, you won’t be able to reference in the Main Game Project, which is a Phone project. How we solve this?
Creating a Project CopyObviously, the solution is to have two different projects/assemblies. One for Windows and another one for WindowsPhone. Of course, as we said that duplicating is wrong, we don’t want to duplicate the classes and code in both projects, so the solution is to create a <<project copy>>: an additional project that produces a different assembly type, but that links to the same source files than the other project.
This is a extremely useful feature automated in XNA solutions (you can always do the same manually in other project types). To do so, you just need to right-click in the Solution Explorer, on the project you want to copy, and select:
- Create a copy of project for Windows
- Create a copy of project for Windows Phone
- Create a copy of project for XBox
This way, you can keep the Content Project always referencing Windows Game Libraries, and your main Game project referencing the assembly appropriate for each platform, without duplicating code.