Git, monogame and cross-platform development
I recently started on a small project. We thought out a small game and are now building it. One of the most important aspects is that it works on Windows, Linux and OSX.
To keep things simple for a bit I decided to start development on Windows and convert the game to Linux later, expecting little problems; trusting the MonoGame framework. I am now in that process of porting but stopped very quickly as I ran into a major issue:
You cannot have both a Windows Game and Linux game in the same solution, it won’t run.
I found out you have to start a new Linux MonoGame project and simply copy and paste the code into it. (Which is a terrible way to manage any project).
Working with git; I came up with the following
Ignore changes to all
.slnfiles etc, purely keeping the code in the repository in such a way that the base directory is still in the ‘root’ project folder.
Keep all code in submodules and have the ‘root’ project folder branch out into windows, linux, osx branches to keep different editors’ config files.
The only thing I found with google was about the stuff I just described above. Does anyone have any experience with the issue I described or should I just try something and see if it’s a proper thing to do?
One Solution collect form web for “Git, monogame and cross-platform development”
Essentially you have 2 options. Either use code sharing as described in the Xamarin guidelines here:
Or alternately, there’s a more advanced approach using Portable Class Libraries (although not officially supported yet). I’ve got a description of how that works on my blog.
Neither solution is ideal but they are both better than copy and pasting code.