Running a mono program without typing in 'mono foo.exe'
Does this link help? Running Mono
From the Mono Project on using binfmt:
Registering .exe as non-native binaries (Linux only)
Because this is a Linux-specific feature, we do not recommend that developers deploy this solution, as it would limit the portability of their scripts.
In addition, this mechanism does not work as intended by the Application Deployment Guidelines.
You can also make a systemwide change, and use binfmt to register the exe files as non-native binaries. Then, when trying to launch an exe file, the kernel will run the mono interpreter to handle the command. Binfmt can also be used to launch Windows executables using WINE, or Java .class files using a JVM. To register exe with the kernel:
Become root and turn on the binfmt module in your kernel with this command:
sudo apt-get install binfmt-support
modprobe binfmt_misc
In addition, you may want to add the modprobe
command to your /etc/rc.local
boot script, so that it will be executed on boot.
Add the line below to your /etc/fstab
file:
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc none
Then, have your system run the following command on boot:
echo ':CLR:M::MZ::/usr/bin/mono:' > /proc/sys/fs/binfmt_misc/register
Be sure to mark your .exe files as executable in the filesystem as well:
chmod +x myprogram.exe
Note that this doesn't change your kernel, just the modules that it loads when you boot your system. In other words, you can still upgrade your kernel without worrying about losing these changes. Similarly, you can upgrade your Mono runtime without affecting any of the invocation methods listed in this section.
Create a startup script.
Open a plain text editor, add this:
#!/bin/bash
mono foo.exe &
Depending on your setup, you may need to use the full path for foo.exe.
Save the file for example as foo.sh
.
Make it executable:
sudo chmod a+x foo.sh
You should now be able to start foo.exe by double-clicking foo.sh
.
You can associate the file extension '.exe' on Nautilus to be executed with /usr/bin/mono