So I have developed a game with Monogame with visual studio and have been able to build it for windows no problem. But after downloading and running Protobuild it seems like I have to create an entirely new project. I also noted that a new protobuild Monogame 2d platformer template refuses to build entirely.
My questions Are:
Is there an easier way to convert my Monogame project to build with Protobuild or do I have to copy/paste/fix everything where it belongs in a new template?
Why doesn’t the default template build? (Not literally the error but why have the devs left it unbuildable by default?)
Finally, am I missing an easier way to just build this Monogame project for linux and mac without converting it to Protobuild?
Protobuild has a command to sync your project files to your .definition files. Use Protobuild --sync.
Looks like it was created a long time ago and there’s no build server that tests if anything is broken. You can open an issue on the GitHub repo of the template.
There are a few alternatives. You can put shared game stuff in a seperate library and reference that from your platform-specific projects. It seems like you only target desktops atm, so you can also use the DesktopGL template. It will run on Windows, Mac and Linux. Another option is using a Shared Project for shared code, I prefer this over using a library. This is really nice because you can have your .mgcb in the shared project and it will automatically build for the right platform when you build a project. You need to add the MonoGameContentBuild build action manually in the shproject though. You can use partial methods and classes for platform specific stuff.
We only recently got the build server working again for Protobuild, so we had a pretty big period there where we weren’t doing continuous builds on the templates.
I can take a look at the MonoGame template on Friday. Currently the MonoGame template that is used by Protobuild isn’t upstreamed (waiting on a PR to be merged), so it’s up to me to keep it updated.
We don’t have great tooling around converting an existing C# project to Protobuild, and this is because C# projects can be configured a near infinite number of ways due to MSBuild. It’s on our roadmap to do something better here, but in the meantime there’s advice on converting existing projects at: https://protobuild.readthedocs.io/en/latest/project_migration.html
I feel like an idiot. It IS a desktopGL app and I didn’t realize the windows generated executable was available on linux/mac through mono and I can just include monokickstart with my project.
I may have to come back to protobuild in the near future, but it was really confusing trying to get the build to work even with all the references appearing properly in Visual Studio. (Side note: I had to change the target net framework in the project to 4 from 4.5 to even get the entry point functional, overall it felt like a bad experience and the documentation did not cover it well at all.)
Okay, so I had a look into this. For some reason after generating the template through the Protobuild Manager, it didn’t resolve the packages, which meant there wasn’t a MonoGame binary for your project to reference. I don’t yet know why this occurred (when I tried to create a new project).
It’s expected when you use that template that you’ll end up with something like this in Visual Studio:
I’ve started setting up the builds on the build server for all of these templates and now I’m attempting to replicate the issue where the packages aren’t resolved.
Alright, I’ve replicated the issue and it is a bug in Protobuild that occurs when Module.xml is upgraded.
Basically the list of steps required to reproduce it are:
Start from a template that still has the old Module.xml format
Run --generate
At this point, it will generate the projects but won’t have performed package resolution. It will however have upgraded Module.xml. If you try and open the project in Visual Studio now, things won’t work.
Run --generate again
Now with the newly upgraded Module.xml, it’ll go through and resolve the packages correctly. Opening in Visual Studio or otherwise building after this point will work, and the game will start successfully.
I’m going to try and have this issue fixed by the end of today, and I’ll post an update here when it’s been corrected.
If you go to the Protobuild website, download and install the latest version of the Protobuild Manager: https://protobuild.org/
Now when you create a new MonoGame project through the Protobuild Manager, you should notice it taking a little bit longer during the generation before Visual Studio opens. Once Visual Studio opens you should notice that all the required projects are present as per the screenshot above.
If you have any further issues, please let me know.