Freigeben über


Build-time content pipeline usage in Windows games

One of the problems that some folks have hit in XNA Game Studio 4.0 is not being able to use the build-time content pipeline assemblies in their Windows games. Generally this is desired when developers are trying to save out an object using the IntermediateSerializer so they can use the resulting XML as a template to create more of those files as content in their project.

One of the gotchas with this is that XNA Game Studio 4.0 Windows games default to using the .NET Framework 4.0 Client Profile. The Client Profile is a slimmed down set of the .NET Framework that contains most of the functionality a shipping product would need. This profile was created so that .NET applications can use a smaller .NET Redistributable and therefore be a smaller total package size for users. However the Client Profile does not contain a lot of the build-time features of the .NET Framework such as MSBuild.

In order to use the build-time content pipeline assemblies and functionality, you must switch your game to use the full .NET Framework. This is a pretty easy set of steps to fix up:

  1. Right click the game project and select Properties.
  2. Find the Target Framework drop down menu which should say .NET Framework 4.0 Client Profile and change that to just .NET Framework 4.0.
  3. Save the properties (which will cause a project reload) and your game now targets the full .NET Framework.

Once you’ve switched the target framework, you should find all of the build-time assemblies of .NET Framework show up in the Add References dialog including the build-time content pipeline assemblies.

Do keep in mind that this doesn’t change anything in terms of the EULA or what you are permitted to redistribute with your Windows game; you should read the EULA for XNA Game Studio before distributing your Windows game to ensure that you are following all of the rules. But for simply finding out how to format your XML or for using the build-time components for some other reason, this should help you get up and running.

Comments

  • Anonymous
    December 09, 2010
    Thank you so much!!!!!!!!!!!!!  This saved me so much time and sleepless nights!  

  • Anonymous
    April 26, 2011
    This just got me out of a bind, thanks for the information!

  • Anonymous
    March 25, 2013
    i am developing a simple and my first game for widows phone in XNA i need some help about it , where can i post that? :P