One project for many platforms.

Hello. How can I build one project for multiple platforms like in Unity? (For Windows, Android and iOS)
I looked for “common project”, the main code project which will execute from Android and Windows but I got 2 problems:
1.I have bigger file size because I have monogame.framework.portable(from nuget) in this common project and monogame.framework.android & windows in other projects.
2.I don’t know how to set up content for this project

I saw few similar topics but still didn’t find an answer.

And maybe, is there way to do it without the shared project?

I’m coding on Windows, VS 2017.

I went with a Portable Class Library. I put the bulk of my Game’s code in PCL and then have a very lightweight launcher assembly for each of my platforms. All they do is create the appropriate dependencies for the main game (including platform specific ones where required) and then start the main game. I’m not sure about the file sizes… what mine is generating seems manageable. Does this really matter all that much?

Regarding content, that was also quite easy to set up. Just create a MonoGame Content Project somewhere convenient to your platform projects and add them as an existing item to your platform specific projects.

Here’s a screenshot showing my main project arrangement…

Content.mgcb in both CodeLogic_Android and CodeLogic_Windows is the same file.

You should note that Microsoft went ahead and deprecated Portable Class Libraries recently. They want you to use .NET Core projects. I have no idea what’s involved in porting these over though because l, at the time of writing, can’t find a .NET Core version of MonoGame on NuGet. The PCL version is still there though and works. I’m also still able to create new PCL assemblies.

Anyway, hope that helps :slight_smile:

Just in case you need a video tutorial: