Mono Framework is a free and open-source version of Microsoft’s.NET Framework. It allows developers to build and run cross-platform apps on Linux, macOS, and Windows. Novell Inc has been working on it since 2002. Class libraries or other components that are intended for Microsoft’s original.NET runtime can be executed by Mono, which offers a full version of the CLR (Common Language Runtime). Every system that has a current installation of Mono installed can use these class libraries.
Developers can create applications in C#, Visual Basic, and F#, among other programming languages, with Mono. Many developers utilize Mono, which makes it simple to incorporate.NET technology throughout your apps.
Mono-complete Linux is an OS that runs Microsoft.NET Framework executables using the Xamarin tool from Mono. It uses the Mono framework as its main platform for application development. Depending on the user’s preferences, Mono-complete Linux can be installed among other operating systems or completely replaced.
Betterment of Mono Framework
- Cross-platform compatibility
- Language interoperability
- High-performance
- Large Developer Community
- Excellent Development Tools
- ASP.NET Support
- Integrated Development Environment (IDE) Support
- Tooling and Development Resources
Installation of Mono Microsoft’s .NET Framework on Debian 12
This guide will walk you through how to Install Mono Microsoft’s .NET Framework on Debian 12. Without taking time, let’s get started.
1. Update the System
Update your Debian 12 operating system to ensure that all installed packages are the most recent versions.
sudo apt update && sudo apt upgrade -y
Once the System packages are updated proceed with the installation.
2. Install Required Dependencies
The following dependencies are required for Mono to install and function properly on your Debian 12 system. Execute:
sudo apt install gnupg dirmngr apt-transport-https ca-certificates -y
You’re now ready to install Mono.
3. Import Mono GPG Key and Repository
Run the command below to add the Mono GPG key to your Debian 12 system.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
With the GPG key installed on the machine, use the following command to add the Mono repository, which offers the most recent Mono package that is officially supported.
sudo sh -c 'echo "deb https://download.mono-project.com/repo/debian stable-buster main" > /etc/apt/sources.list.d/mono-official-stable.list'
sudo apt update
To find out if mono is in your local repository, perform the following command.
sudo apt search mono
Sample output:
The next step is to Install Mono Framework.
4. Install Mono Framework
Now that the repository is installed correctly, it’s time to install Mono. To do this, run the apt install command listed below.
sudo apt install mono-complete -y
Verify the installed Mono version.
$ mono --version
Mono JIT compiler version 6.12.0.200 (tarball Tue Jul 11 21:32:10 UTC 2023)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: yes(610)
Suspend: hybrid
GC: sgen (concurrent by default)
Another way to verify the installation of the Mono Framework is to use the apt-cache policy command.
$ sudo apt-cache policy mono-complete
mono-complete:
Installed: 6.12.0.200-0xamarin2+debian10b1
Candidate: 6.12.0.200-0xamarin2+debian10b1
Version table:
*** 6.12.0.200-0xamarin2+debian10b1 500
500 https://download.mono-project.com/repo/debian stable-buster/main amd64 Packages
100 /var/lib/dpkg/status
6.8.0.105+dfsg-3.3 500
500 http://deb.debian.org/debian bookworm/main amd64 Packages
We have successfully installed Mono.
5. Create a Test Application
In order to generate a basic Mono application, launch your preferred text editor and generate a new file called hello.cs
. To construct the file for this example, we’ll utilize the Vim text editor.
vim hello.cs
Paste the below content.
using System;
public class HelloWorld
{
public static void Main(string[] args)
{
Console.WriteLine ("Hello World,it's Mono Framework!");
}
}
After creating the C# code file that Mono will convert into an executable, it’s time to compile the code into bytecode. Run:
mono-csc hello.cs
With the aforementioned command, mono -csc is instructed to use the Mono compiler to compile hello.cs. The compiler takes the source code and creates .exe file in response. Confirm by:
$ ls -l *.exe
-rwxr-xr-x 1 cloudspinx cloudspinx 3072 Nov 4 22:52 hello.exe
To run the application, use the mono command with the filename as an argument.
$ mono hello.exe
Hello World,it's Mono Framework!
That’s all!
Finale
Having installed Mono on your Debian 12 machine, you are now able to develop C# applications. Please feel free to review the official documentation for additional details. We hope that this post will assist you in successfully installing Mono on your machine.
Check also these guides: