Difference between revisions of "Mono"

From ArchWiki
Jump to: navigation, search
(Added a section on blocking Mono.)
m (Style fixes (capital letter).)
(17 intermediate revisions by 9 users not shown)
Line 1: Line 1:
[[Category:Development (English)]]
+
[[Category:Development]]
[[Category:HOWTOs (English)]]
+
 
+
 
+
==Introduction==
+
 
Mono is an open source, cross-platform, implementation of C# and the CLR that is binary compatible with Microsoft.NET.
 
Mono is an open source, cross-platform, implementation of C# and the CLR that is binary compatible with Microsoft.NET.
  
The Arch Linux packages of mono have activated the experimental .NET 4.0 features, but be aware that it's maybe not stable. Those features are only related for developers, if you just use Mono to run applications written in Mono then you will be not affected by this.
+
== Installation ==
==Installation==
+
First install mono with pacman:
+
  
# pacman -S mono
+
Mono can be [[pacman|installed]] with the package {{Pkg|mono}}, available in the [[official repositories]].
  
If you need VisualBasic.Net support you have to install the VisualBasic.Net interpreter with pacman:
+
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.
  
# pacman -S mono-basic
+
== Running Mono applications ==
  
==Registering Mono Applications with the Kernel==
+
You can execute Mono binaries by calling {{ic|mono}} manually:
  
You can execute binaries by calling '''mono''' manually
+
$ mono programsname.exe
  
mono programsname.exe
+
You can also execute Mono binaries directly, just like native binaries:
  
It is also possible to tell the kernel to use '''mono''' as an interpreter for all Mono binaries. For doing this, just add mono to your daemons array in /etc/rc.conf and it will be automatically setup for you.
+
$ chmod 755 exefile.exe
 +
$ ./exefile.exe
  
DAEMONS=( ..... mono .... )
+
== Testing Mono ==
  
Now try this:
+
Make a new file:
 
+
{{hc|test.cs|
chmod 755 exefile.exe
+
./exefile.exe
+
 
+
==Testing Mono==
+
Make a new file; test.cs
+
<pre>
+
 
using System;
 
using System;
  
Line 41: Line 30:
 
  }
 
  }
 
}
 
}
</pre>
+
}}
 
Then run:
 
Then run:
<pre>
+
{{bc|
 
$ mcs test.cs
 
$ mcs test.cs
 
$ mono test.exe
 
$ mono test.exe
 
Hello world!
 
Hello world!
</pre>
+
}}
 
+
==Blocking==
+
Due to patent or other concerns, some may wish to block Mono from Arch Linux. To do this, simply open {{Filename|/etc/pacman.conf}} and simply ignore the mono and libgdiplus packages as such:
+
 
+
IgnorePkg=mono libgdiplus
+
  
==Development==
+
== Development ==
Starting to develop in Mono/C# is very easy. Just install the [http://monodevelop.com/ MonoDevelop IDE] and debugger support with pacman:
+
  
# pacman -S monodevelop monodevelop-debugger-gdb monodevelop-debugger-mdb
+
Starting to develop in Mono/C# is very easy. Just [[pacman|install]] the [http://monodevelop.com/ MonoDevelop IDE] and debugger support with packages {{Pkg|monodevelop}}, {{Pkg|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 the mono-tools:
+
If you want the API documentation browser and some testing and development tools you have to install {{Pkg|mono-tools}}.
+
# pacman -S mono-tools
+
  
== Resources & Links ==
+
== Troubleshooting ==
[http://www.mono-project.com Official Mono website]
+
  
[http://mono-project.com/Monkeyguide The Mono Handbook]
+
{{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].
  
[http://go-mono.org/docs The API reference of Mono]
+
To fix this, [[daemon|restart]] the {{ic|systemd-binfmt}} service.
 +
}}
  
[http://www.ecma-international.org/publications/standards/ECMA-334.HTM ECMA-334: C# Language Specification]
+
== See also ==
  
[http://www.ecma-international.org/publications/standards/ECMA-335.HTM ECMA-335: Common Language Infrastructure (CLI)]
+
* [http://www.mono-project.com Official Mono website]
 +
* [http://mono-project.com/Monkeyguide The Mono Handbook]
 +
* [http://go-mono.org/docs The API reference of Mono]
 +
* [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.mono-project.com/Guide:Running_Mono_Applications Instructions for running Mono applications]

Revision as of 09:52, 1 November 2013

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