From ArchWiki
Revision as of 09:14, 25 March 2009 by Maskawanian (talk | contribs)
Jump to: navigation, search


Mono is an open source, unix implementation of the Microsoft .NET framework.


First install mono with pacman:

# pacman -Sy mono

Registering Mono Applications with the Kernel

You can execute binaries by calling mono manually

mono programsname.exe

It is also possible to tell the kernel to use mono as an interpreter for all Mono binaries. First mount the binfmt_misc filesystem:

mount -t binfmt_misc none /proc/sys/fs/binfmt_misc

or add this line to your /etc/fstab

none  /proc/sys/fs/binfmt_misc binfmt_misc defaults 0 0

Then tell the kernel how to interpret Win16 and Win32 binaries:

echo ':CLR:M::MZ::/usr/bin/mono:' > /proc/sys/fs/binfmt_misc/register

You can add this line to /etc/rc.local to make this setting permanent. In this case you may want to ignore stderr to avoid error messages when changing runlevels:

{ echo ':CLR:M::MZ::/usr/bin/mono:' > /proc/sys/fs/binfmt_misc/register; } 2>/dev/null

Now try this:

chmod 755 exefile.exe

Testing Mono

Make a new file; test.cs

using System;

public class Test {
 public static void Main(string[] args) {
  Console.WriteLine("Hello World!");

Then run:

$ mcs test.cs
$ mono test.exe
Hello world!


Official Mono website