Set up MonoDevelop on Debian 12 Bookworm

This tutorial intends to teach you to Set up MonoDevelop on Debian 12 Bookworm. MonoDevelop makes it easy for developers to port .NET applications created with Visual Studio to Linux and to maintain a single code base for all platforms.

Now Follow the steps below to install and make a sample project with MonoDeelop on Debian 12.

Easy Guide To Set up MonoDevelop on Debian 12 Bookworm

To complete this guide, you must have access to your server as a non-root user with sudo privileges. For this purpose, you can follow this guide on Initial Server Setup with Debian 12 Bookworm.

Step 1 – Run System Update and Install Dependencies for MonoDevelop

First, you need to update and upgrade your local package index with the following command:

sudo apt update && sudo apt upgrade

Then, you need to install the MonoDevelop dependencies on Debian 12 with the following command:

sudo apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common -y

Step 2 – Add Mono GPG Key on Debian 12

At this point, you need to add the Mono Project GPG Key on Debian 12 with the following command:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF

In your output, you will see:

Output
gpg: key A6A19B38D3D831EF: public key "Xamarin Public Jenkins (auto-signing) <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1

Step 3 – Add Mono Repository on Debian 12

Now you can add the Mono repository on your server by using the command below:

sudo sh -c 'echo "deb https://download.mono-project.com/repo/debian stable main" > /etc/apt/sources.list.d/mono-official-stable.list'

When you are done, proceed to the next step to install MonoDevelop on your server.

Step 4 – Install MonoDevelop on Debian 12 Bookworm

First, you must run the system update with the command below:

sudo apt update

Then, use the following command to install MonoDevelop on Debian 12:

sudo apt install mono-complete -y

Note: If you want to build your project through the IDE development method, you can use the following command:

sudo apt install monodevelop -y

To verify that your MonoDevelop software is installed correctly on your server, run the command below to check its version:

mono -V
Output
Mono JIT compiler version 6.8.0.105 (Debian 6.8.0.105+dfsg-3.3 Wed Dec 14 11:18:08 UTC 2022)
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:          supported, not enabled.
        Suspend:       hybrid
        GC:            sgen (concurrent by default)

Step 5 – How To Create a Sample Project with Mono?

At this point, we want to show you how to use MonoDevelop by creating a sample Hello World program.

Create and open the file with your favorite text editor, we use the vi editor:

sudo vi hello.cs

Add the following content to the file:

using System;    public class HelloWorld  {  public static void Main(string[] args)  {  Console.WriteLine ("Hello World!");  }  }

When you are done, save and close the file.

Now build your program with the CSC:

mcs hello.cs

Then, run the mono command with your program on Debian 12:

mono hello.exe
Output
Hello World!

Also, you can use the following command to set an executable flag:

chmod +x hello.exe

Now you can execute the program only by typing its name:

./hello.exe
Output
Hello World!

For more information, you can visit the MonoDevelop Documentation Page.

Conclusion

You have learned to Set up MonoDevelop on Debian 12 Bookworm by adding the Mono Project GPG Key and Repository and creating a sample project with Mono.

Hope you enjoy it. You may be interested in these articles on the Orcacore website:

Stress Test and Benchmark CPU Performance Debian

Install Dropbox on Debian 12 Bookworm

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!