I have been developing a game with Monogame in Windows using Visual Studio. I have just got Monogame installed on Linux and would like to transfer development to that platform. Visual Studio is not available, and it seems like the done thing is command line building (dotnet plublish). I have achieved this with a new test project (created with dotnet new), but I can’t build my game that was made with Visual Studio. Is there a way of modifying my existing project so that it can be built in Linux? Or do I have to create a new project and import all my files into it?
Hi Andy,
Can you confirm that the new test project (created with dotnet new) was dotnet-published successfully? If not, you may be missing some dependencies. The MonoGame docs describe how to set up your environment, at least on the Ubuntu family of distros.
Which Linux distro (build) are you using?
And what error are you getting in the Linux terminal?
Also, I assume your existing game uses mgdesktopgl, though I haven’t tested building mgwindowsdx on Linux myself.
Hey! I have been able to create and build a test project using dotnet new, so things are set up correctly. My problem is in allowing my existing project to work on Linux. It is an mgdesktopgl project that references a shared library containing all of my source code and content (except for my program.cs file). It also contains shaders, which complicate matters.
I did once have the project building correctly on Linux with Monodevelop, shaders included using InfinitespaceStudios.Pipeline. However that was a while ago and since Monogame has been updated I can’t get that to work anymore.
I got shader compilation working on linux with wine. I remember following the official docs so the link above from @gluser should provide the right information.
I would say break your project down into smaller parts much like you’d debug normally. Test a dotnet new with your shared library first, then the shaders. If one or both of them gives an error, break it down further until you’ve identified the one thing that doesn’t transfer over.
Thanks to Kwyrky’s comment, we know shaders compile on Linux so yours should work too with any luck.
I have managed to get my game building on Linux. I apparently can’t do the command line method as the project is .NET Framework and not .NET Core, but I have been able to get it to build in the Rider IDE. I’ve been able to get shaders working using a remote Windows server, but am still trying to get them working with Wine.