Can't execute game without terminal

Hi,

I’ve recently upgraded my ubuntu to version 14.04, before that, i could run my compiled games simply by double clicking on them, or right clicking > execute. No terminal window would be shown.

Since the upgrade, it seems I can only run it with “Mono Runtime (Terminal)”, not so “Stand-alone” as before. Is there some way to hide the terminal or just execute the .exe as before? I was thinking of uninstalling mono, but that would cause more problems, I suppose.

Thanks, sorry for my bad english and noobish question.

2 things make them run in terminal:

  1. Before you compile your game, right click on the project, go to options > basic > general > c# and select “Executable with GUI” for Compile Target, and than compile.

  2. Mono Runtime (Terminal) means that it will start your game with terminal. To fix that navigate to your games location using terminal, and that type in: “mimeopen -d game.exe” where game.exe is your game. Then type in the number that says “Mono Runtime (mono-runtime-common)”, and press Enter. Now when you right click the game you’ll get an option that just says “Mono Runtime”

It works, thanks. (:

Although it does not load some relative path files properly, since the working directory changes to home… But that’s fine, some simple launcher script should do the trick.

Oh yea, I forgot to mention that, thats the problem with Nautilus, Ubuntus default file manager. I recomend you try out Thunar. Also nice idea to have a launcher script.

Ok, I’ll try Thunar. Yes, a bash script solves it, the working directory changes to that of the file, I don’t understand the logic behind that, but it works.

The logic is that there is a bug in Nautilus where it chooses the working directory for other programs executed by it from the base directory where nautilus was executed from. So if you start Nautilus using terminal when you are in some other directory, than it will be the working directory for any application executed by Nautilus. I think the bug has been fixed for normal executables, but still remains with mono applications.

PS. I have a small fix that allows you to run monogame directly from Nautilus. If you want it, just say and I will post it below.

Makes sense, thanks for explaining. Yes, I would like it, if it’s not too much work for you.

Here’s what you do:
Step 1: Run “sudo apt-get install menulibre” in terminal
Step 2: Create a text file named “mono.sh” with the following content:

#!/bin/bash
cd $(dirname $1)
mono "$1"

Step 3: Right click on that text file, go to Properties > Permissions and make sure that “Allow executing file as program” is checked
Step 4: Open menu editor(or type in menulibre in terminal) and search for mono
Step 5: Click on mono runtime from left panel, then click on the button next to command(browse button), and find and select “mono.sh”
Step 6: Save
Step 7: Do the same for mono runtime terminal

Thanks again, really useful.

If the folder contains space or any other special character, the script will not work. I have to think of a solution for that…