In a previous post I described how to integrate XNA Game Studio Content Pipeline Projects into your MonoGame pipeline. The downside of the previous recipe is that is requires a paid edition of Visual Studio 2012. This recipe will show you how to incorporate the outputs of a XNA Game Studio 4.0 Content Pipeline project into your MonoGame for Windows 8 project. While not as complete and automated as the previous recipe, it is the best we can get until the MonoGame team completes the development of the Content Pipeline Projects.

Similar to the previous recipe, you will not need VS 2010 anymore, unless you are converting an existing XNA GS 4.0 project, which is a topic I’ll cover in a later post. With a few minor changes to your MonoGame project file, but all with the Express Editions of Visual Studio.

Ingredients List

Make sure you have the following products installed :

Recipe

  1. Create new MonoGame project and solution

    1. Open Visual Studio 2012 Express for Windows 8 image

    2. Create a new MonoGame Project

      1. File -> New -> Project [CTRL-SHFT-N]

      2. Select “MonoGame Game” from the Visual C# / MonoGame  category

      3. Give your Game Project a name, folder and solution name image

      4. Click “Ok” to create your game project

  2. Create a new Windows Phone 8 XNA Game Project

    1. Open Visual Studio 2012 Express for Windows Phone image

    2. Create a new MonoGame Project

      1. File -> New -> Project [CTRL-SHFT-N]

      2. Select “Windows Phone Game (4.0)” from the Visual C# / XNA Game Studio 4.0  category

      3. Give your Game Project a name, select the same folder as your MonoGames solution above and deselect the option “Create directory for solution” image

      4. Click “Ok” to create your game project

  3. Add some test content

    Now we will add some artwork and sound to the XNA Content Project and build the XNB files.

    1. Download sample assets from the Game Development Tutorial from the XNA XBox Line Indies game site.

    2. Extract the contents of the zip file into a folder. image

    3. Right-Click the Content Project

    4. Add -> Existing Item[SHFT-ALT-A]

    5. Navigate to the the folder Shooter\Shooter\ShooterContent under the folder where you extracted the files and select all files image

    6. Click Add image

    7. Right-Click the Content Project

    8. Add -> New Folder

    9. Name it Sound image

    10. Right Click the Sound Folder

    11. Add -> Existing Item [SHFT-ALT-A]

    12. Navigate to the the folder Shooter\Shooter\ShooterContent\Sound under the folder where you extracted the files and select all files image

    13. Click Add image

    14. Right-Click the WindowsPhoneGame project and click build image

  4. Modify MonoGame 

    Finally we will link the compiled XNB files from the XNA GS build to our MonoGame project.

    1. [ALT-TAB] back to the Visual Studio 2012 Express for Windows 8 with our MonoGame project open in it. image

    2. Right-Click the MonoGame Project File

    3. Add -> New Folder

    4. Name it “Content” image

    5. Right-Click the Content Folder

    6. Add -> Existing Item[SHFT-ALT-A]

    7. Navigate to the folder WindowsPhoneGame\WindowsPhoneGame\bin\Windows Phone\Debug\Content under your MonoGame solution folder. image

    8. Select all the .xnb files in the folder and “Add As Link” image

    9. Right-Click the Content Folder

    10. Add -> New Folder

    11. Name the new folder “Sound” image

    12. Right-Click the Sound folder

    13. Add-> Existing Item [SHFT-ALT-A]

    14. Navigate to the folder WindowsPhoneGame\WindowsPhoneGame\bin\Windows Phone\Debug\Content\Sound under your MonoGame solution folder. image

    15. Select all the .xnb files in the folder and “Add As Link” image By using “Add as Link” when you change the original assets and recompile them using the WindowsPhone project, they will automatically be updated the next time you recompile the MonoGame Project.

    16. In the Solution Explorer, select all the xnb files under the Content Folder image

    17. In the Properties Window [Alt-F4] Change Build Action to “Content” image This setting will force the content to be copied into the packaging folder where it can be found when the game runs under the WinRT subsystem.

  5. Build + Test

    Now you can complete the tutorial on the XNA Xbox Live Indie Games website. NOTE: You will need to edit the names of the class fields and their usages in the Game class to remove the leading underscore. image

KeepTheCash_120_0315Keep the Cash • Publish an app • Get up to $2000* Publish your app(s) in the Windows Store and/or Windows Phone Store and fill out the form at build.windowsstore.com/keepthecash to participate. You can submit up to 10 apps per Store and get $100 for each qualified app up to $2000.

*Offer good only to the first 10,000 qualified applications published in the Windows Store and/or Windows Phone Store, or until the end of the promotional period, whichever comes first. Limit 10 entries per publisher ID and up to $2,000 per person.