Difference between revisions of "Mono"

From ArchWiki
Jump to: navigation, search
(Removed text pertaining to nonexistent "mono" kernel module. The systemd-binfmt service sets up kernel handling of Mono binaries. Added text explaining this.)
Line 6: Line 6:
  
 
If you need VisualBasic.Net support you have to [[pacman|install]] the VisualBasic.Net interpreter with the package {{Pkg|mono-basic}}, available in the [[Official Repositories]].
 
If you need VisualBasic.Net support you have to [[pacman|install]] the VisualBasic.Net interpreter with the package {{Pkg|mono-basic}}, available in the [[Official Repositories]].
==Registering Mono Applications with the Kernel==
 
  
You can execute binaries by calling {{ic|mono}} manually
+
==Running Mono Applications==
  
mono programsname.exe
+
You can execute Mono binaries by calling {{ic|mono}} manually:
  
It is also possible to tell the kernel to use {{ic|mono}} as an interpreter for all Mono binaries. To do it, just load {{ic|mono}} [[kernel module]] and it will automatically be setup for you.
+
mono programsname.exe
  
Then try this:
+
You can also execute Mono binaries directly, just like native binaries:
  
 
  chmod 755 exefile.exe
 
  chmod 755 exefile.exe
Line 41: Line 40:
  
 
If you want the API documentation browser and some testing and development tools you have to install {{Pkg|mono-tools}}.
 
If you want the API documentation browser and some testing and development tools you have to install {{Pkg|mono-tools}}.
 +
 +
==Troubleshooting==
 +
{{FAQ
 +
|question=I get an error when I try to run Mono binaries directly: "cannot execute binary file"
 +
|answer=The [[Wikipedia:Binfmt_misc|binfmt_misc]] handler for Mono has not yet been set up, as explained in detail on the [http://www.mono-project.com/Guide:Running_Mono_Applications#Registering_.exe_as_non-native_binaries_.28Linux_only.29 Mono Project website].
 +
 +
To fix this, restart the {{ic|systemd-binfmt}} service:
 +
 +
{{bc|
 +
# systemctl restart systemd-binfmt
 +
}}
 +
}}
  
 
== See also ==
 
== See also ==
Line 48: Line 59:
 
*[http://www.ecma-international.org/publications/standards/ECMA-334.HTM ECMA-334: C# Language Specification]
 
*[http://www.ecma-international.org/publications/standards/ECMA-334.HTM ECMA-334: C# Language Specification]
 
*[http://www.ecma-international.org/publications/standards/ECMA-335.HTM ECMA-335: Common Language Infrastructure (CLI)]
 
*[http://www.ecma-international.org/publications/standards/ECMA-335.HTM ECMA-335: Common Language Infrastructure (CLI)]
 +
*[http://www.mono-project.com/Guide:Running_Mono_Applications Instructions for running Mono applications]

Revision as of 16:20, 20 December 2012

Mono is an open source, cross-platform, implementation of C# and the CLR that is binary compatible with Microsoft.NET.

Installation

Mono can be installed with the package mono, available in the Official Repositories.

If you need VisualBasic.Net support you have to install the VisualBasic.Net interpreter with the package mono-basic, available in the Official Repositories.

Running Mono Applications

You can execute Mono binaries by calling mono manually:

mono programsname.exe

You can also execute Mono binaries directly, just like native binaries:

chmod 755 exefile.exe
./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!

Development

Starting to develop in Mono/C# is very easy. Just install the MonoDevelop IDE and debugger support with packages monodevelop, monodevelop-debugger-gdb, available in the Official Repositories.

If you want the API documentation browser and some testing and development tools you have to install mono-tools.

Troubleshooting

Template:FAQ

See also