Mono - ArchWiki

# Mono

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

### I get an error when I try to run Mono binaries directly: "cannot execute binary file"

The binfmt_misc handler for Mono has not yet been set up, as explained in detail on the Mono Project website.

To fix this, restart the `systemd-binfmt` service.

### I get an TLS handshake (or similar certificate based) error

Try `mozroots --import --ask-remove` which should update monos certificates. `mozroots` is part of the mono package.

## See also

- Official Mono website
- The Mono Handbook
- The API reference of Mono
- ECMA-334: C# Language Specification
- ECMA-335: Common Language Infrastructure (CLI)
- Instructions for running Mono applications

Category:

- Development