Mono - ArchWiki

Jump to content

# Mono

4 languages

- Español
- 日本語
- Polski
- 中文（简体）

From ArchWiki

Related articles

- .NET

From Wikipedia:

  Mono is a [...] project to create a .NET Framework-compatible set of tools including, among others, a C# compiler and a Common Language Runtime.

## Installation

Install the mono package.

If you need VisualBasic.Net support you have to install the VisualBasic.Net interpreter with the package mono-basicAUR.

Note: Installing the package stores certificate authorities in `/usr/share/.mono/certs/Trust/` but removing the package does not remove them.[1]

## 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

OmniSharp provides .NET/Mono development plugins/integrations for several editors, including Vim, Emacs, and Visual Studio Code.

Alternatively, you can install the riderAUR IDE. If you install Rider not from AUR, you would need to install mono-msbuild, as recent Rider versions dropped support of xbuild in favour of MSBuild from net-core.

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

This can be caused by either certificates missing from Mono's certificate store, or stale broken certificates remaining in Mono's certificate store.

If possible, ensure that the system certificate store is in good order by running `curl -vI` or similar to replicate the failing request outside Mono.

- `cert-sync /etc/ssl/certs/ca-certificates.crt` synchronises the mono store with the system store, adding missing certificates.
- To remove broken certificates (i.e., if above didn't help), remove the directory `/usr/share/.mono`, then re-run `cert-sync /etc/ssl/certs/ca-certificates.crt`
- As last resort, the older tool `mozroots --import --ask-remove` bypasses the system certificate store and directly downloads Mozilla's trust store. This again does not remove broken certificates, and can cause other problems if you rely on private CAs.

Both `cert-sync` and `mozroots` are 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:

- Frameworks