MonoGame cross-platform solution question

Hello guys,

I want to know what is the most common way to organize MonoGame solution for several platforms.

Currently I have MonoGame solution (Windows) which I want to compile for Windows Phone, also I’ll want to compile it for Android and iOs in the near future.

For Windows Phone, I made duplicate Windows Phone Class Library project for each game project (library) with the links to the original source files and use #if directives in the source code. Is it correct approach?

What about Android and iOs? Will I have to create duplicate projects for these platforms also or should I use something like Portable Class Libraries without projects duplication?

I made my own system for cross-platform solutions, but as I am not a professional (i’m more like a 17 years old learning guy), there may be a better way to do so.

I have several projects in one solution : one project for each platform, containing only the references and Program.cs, and then a shared project containing all the code of the game, including the content MGCB file. This shared project is referenced on each of the Platform projects, so launching my game from any platform is as simple as running from the desired Platform project.
Please note that shared projects are only available on Xamarin Studio and Visual Studio 2015 for mac and Windows (I don’t know anything about Linux though)

This is the way I do it, but i’ve already heard about other solutions like Protobuild. I tried to make this work, but the lack of documentation made me choose my own solution, but I still suggest you to search for it as the concept seams to be awesome (and it has been officially chosen by the MonoGame team as their system for making cross-platform games)

Hope that helps, and do not hesitate if you have other questions.


Protobuild sounds very promisingly. I’m going to investigate into it. Thank you very much for pointing this out!
I’m a professional developer but I have never developed software for operating systems other then Windows (except Web =).

What is the template of your shared project? How does it reference different MonoGame libraries depending on the selected platform (is it something you have implemented on your own)?
Do you use Mac computer to build Mac version of the game and Windows computer to build Win version of the game?

Hi @lllAlexlll,

I daily build my solution on both of these two platforms (Mac and Windows), and everything works fine. I use the default Shared Project template included in both Xamarin Studio (I use it on my Mac) and VS (on my PC). Just put all your classes in there, and reference it in the platform specific project (created with the simple monogame templates).

In order to use libraries, you also have to reference them on the platform projects. For instance, I have Farseer Physics (a physics engine library) loaded in my solution, and just referencing it makes it work.

And yes, I use my Mac to build the Mac version for my game, and same thing for Windows.

EDIT : I just wanted to add that if you use my solution, you must change the MGCB target platform each time your build to another platform.

Hello @JackDaxter,

I’ve got it. Thank you!