Skip to content

MonoGame Content Processing

tomspilman edited this page Jun 4, 2012 · 39 revisions

NOTE: This is preliminary documentation of a feature in progress!

Introduction

MonoGame like Microsoft XNA depends game content being processed at build time to an optimal format for runtime use. Since at this time MonoGame does not have an independent implementation of the XNA content pipeline we depend on Microsoft's implementation on Windows to build content for non-Microsoft platforms.

Game Project

In Microsoft XNA the game project controls the execution of content building. For MonoGame we follow the same rule with some simple workarounds for non-Windows platforms.

Windows and Windows 8 Metro

If you're targeting MonoGame for Windows or Windows 8 you can simply add the content project to your existing solution. You then edit your game project to include the <MonoGamePlatform> property:

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> <PropertyGroup> <ProjectGuid>{2CAE49BD-8B39-42BE-A010-D3E62657000E}</ProjectGuid> <ProjectTypeGuids>{6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">x86</Platform> <MonoGamePlatform>Windows</MonoGamePlatform>

Non-Windows Platforms

On these platforms the recommended solution is to use a dummy XNA project which executes the content build process. You can either make one dummy project per-platform and put the <MonoGamePlatform> property to either the main <PropertyGroup> or use a single dummy project with a different <MonoGamePlatform> property in each configuration <PropertyGroup>.

Content Project

You should use a standard Microsoft XNA Content Project for MonoGame content.

In the content project you need to add a reference to the 'MonoGame.ContentPipeline.Processors' assembly which contains all the platform specific content processors. You then select the correct MonoGame version of the XNA content processors you're already using.

Note these processors will fall thru to normal XNA behavior if you're not building for MonoGame, so its safe to use them in your Xbox or Windows Phone projects as well.

MonoGame Texture

MonoGame SpriteFont

MonoGame Effect

MonoGame Sound Effect

MonoGame Song

Clone this wiki locally