Exporting on Windows for Linux, How do I actually run the game on Linux/Pop OS?

This may be more of a question about Linux then it is about MonoGame.

After following the instructions from here: Package games for distribution | MonoGame Documentation I was able to get a distributable package working on Windows and Mac.

Starting up the game on Windows is as simple as double clicking the .exe file and on Mac you just have to double click the .app “file”.


Linux export command

dotnet publish -c Release -r linux-x64 /p:PublishReadyToRun=false /p:TieredCompilation=false --self-contained

After running the above on Windows I just copied over the “publish” folder over to my Linux environment running Pop OS. I’ve barely used Pop OS or any Linux distro for that matter and I have no idea how to actually run the game. There’s no obvious file I gotta double click.

I know it should work because I setup a dev environment on Pop OS and it can run my game from VS Code. But I have absolutely no idea what to do with the distributable folder spit out by MonoGame. I’ve only gotten apps to work that I’ve downloaded through the Pop OS app store thing. I don’t know how you’re supposed to get apps acquired outside of that to work.

If anyone could point me in the right direction that would be great.

Thanks!

The file you are looking for will be your game name without an extension.
Before you start it, you will need to right click and select properties.
On the second tab, give Execute permission on Owner or Owner and Group.

Double click to run or ./gamename in the terminal.

Hope this helps,
pherbeas

1 Like

Alright so running it from the command line seems to work, thanks for that! I am getting errors in the terminal, but I played through my game and it worked really well.

I tried double clicking the same file, instead of running it in the terminal and I’m getting the following error. I’m not sure what it means, and clicking “Search in Software” does nothing as far as I know.

Screenshot from 2021-11-19 06-41-23

I tried fussing with the permissions in the properties windows but it didn’t seem to change anything.

Screenshot from 2021-11-19 11-50-46

I’m still not very acquainted with the Linux universe, so I’m not sure if this is the kind of user experience Linux users are expecting. If I just distribute this as is will Linux users be satisfied?

For Windows the thing you download looks like this:
Parent folder
- Application folder
- Double clickable Windows shortcut to .exe file in Application folder

And for Mac it’s even simpler:
Parent folder
- Double clickable .app "file"

What can I do to fix these problems and to make for a smoother experience on Linux like I’ve tried to do for other platforms?

Try changing the group access to read and write as well.

“Most” linux users will know about setting the permissions. There is a terminal command to change the permissions as well… chmod .

Here is a link that explains it:

The error is due to a double ‘/’ in the path.

Hope this helps.

1 Like

Did you ever solve this problem? I have a similar issue. If I publish via the Build menu in Visual Studio 2019, it works. If I publish via command line using “dotnet publish”, it doesn’t. I’ve noticed that publishing from the command line creates my main executable as a “shared library” type file, where as publishing from the Build menu creates an “executable”. I can’t find any way of getting the command line publish to create an executable.

  1. Don’t mind these OpenAL erros. I get the same in Monogame and even LibGDX. If I unplug my Headset, and use the speakers, the error will go.

  2. If you export from a Windows machine to Linux, the permission bits will be gone (or not even be set). That means the user has to mark the file as executable again. That’s because the Windows filesystem uses a different permission system.

Yes I understand that the executable flag needs to be set in Linux, but if my project is built on the Windows machine, from the command line, no matter what I do in Linux, I cannot execute the file because it’s “tagged” as a different mime type. If I build from the menu in Visual Studio, then I can set the executable flag and the game runs. So why does the command line build differ from the Visual Studio build? It’s odd.