How To Install mono-mcs on Debian 11

In this tutorial we learn how to install mono-mcs on Debian 11. mono-mcs is Mono C# 2.0 / 3.0 / 4.0 / 5.0 compiler for CLI 2.0 / 4.0 / 4.5

Introduction

In this tutorial we learn how to install mono-mcs on Debian 11.

What is mono-mcs

mono-mcs is:

This is the Mono C# (C-Sharp) 2.0, 3.0, 4.0 and 5.0 compiler, a platform-independent compiler which produces CIL (Common Intermediate Language) binary executables.

This compiler targets the CLI 2.0, 4.0 or 4.5 runtime version.

The mcs compiler supports different C# versions as follows. With C# 2.0 it supports:

  • generics
  • iterators (yield)
  • nullable value types
  • partial types
  • anonymous methods
  • static classes
  • coalesce operator: ??

With C# 3.0 it supports:

  • Language Integrated Query (LINQ)
  • object initializers
  • collection initializers
  • anonymous types
  • local variable type inference
  • implicitly-typed arrays
  • lambda expressions
  • automatic properties
  • extension methods
  • partial methods

With C# 4.0 it supports:

  • dynamic binding (duck typing)
  • named and optional arguments
  • covariant and contravariant generic type parameters

With C# 5.0 (which is the default) it supports:

  • asynchronous methods
  • caller info attributes (as of Mono 3.0 currently not supported!)

Mono is a platform for running and developing applications based on the ECMA/ISO Standards. Mono is an open source effort led by Xamarin. Mono provides a complete CLR (Common Language Runtime) including compiler and runtime, which can produce and execute CIL (Common Intermediate Language) bytecode (aka assemblies), and a class library.

There are three methods to install mono-mcs on Debian 11. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install mono-mcs Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install mono-mcs using apt-get by running the following command:

sudo apt-get -y install mono-mcs

Install mono-mcs Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install mono-mcs using apt by running the following command:

sudo apt -y install mono-mcs

Install mono-mcs Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install mono-mcs using aptitude by running the following command:

sudo aptitude -y install mono-mcs

How To Uninstall mono-mcs on Debian 11

To uninstall only the mono-mcs package we can use the following command:

sudo apt-get remove mono-mcs

Uninstall mono-mcs And Its Dependencies

To uninstall mono-mcs and its dependencies that are no longer needed by Debian 11, we can use the command below:

sudo apt-get -y autoremove mono-mcs

Remove mono-mcs Configurations and Data

To remove mono-mcs configuration and data from Debian 11 we can use the following command:

sudo apt-get -y purge mono-mcs

Remove mono-mcs configuration, data, and all of its dependencies

We can use the following command to remove mono-mcs configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge mono-mcs

Dependencies

mono-mcs have the following dependencies:

References

Summary

In this tutorial we learn how to install mono-mcs package on Debian 11 using different package management tools: apt, apt-get and aptitude.