How To Set up a development environment for C# on Linux without Visual Studio?

How To Set up a development environment for C# on Linux without Visual Studio?

Fix the common issue with C# .net and Linux

Why?

I am learning programming in an adult education system. So we learn several programming languages at the same time. We recently started working with C#. C# development requires a .net framework, which is basically made for the Windows platform.

That is why it is difficult to write and run such programs on Linux. However, it is not impossible. It is possible to develop in Visual Studio code but VS Code was not really designed for this. It can be used to solve the advantages of the C# development environment with different add-ons.

Programming C# on Linux without Visual Studio or Visual Studio Code

With another method, however, we can create an environment (which has worked well for me so far). If you want a free environment that also runs under Linux, then using MonoDevelop IDE can be a good alternative.

Monodevelop's website

I switched to Linux about two years ago, which I wrote about in this post. Since then I have avoided having to touch Windows again. This time is no different, but due to my studies, I have to make certain compromises. In any case, as long as it can be solved in another way, I am looking for solutions of this kind.

Note: Everything, that works with Ubuntu should work with Pop OS as well because Pop OS is based on Ubuntu.

Installation

So, here's how to install MonoDevelop IDE on your Linux system (I'm using Pop OS).

Install MonoDevelop with these commands in your terminal:

sudo apt install apt-transport-https dirmngr sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF echo "deb https://download.mono-project.com/repo/ubuntu vs-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-vs.list sudo apt update

You might need to install .net framework:

Step 1 – Enable Microsoft PPA

In your terminal enter these:

wget <https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.debsudo> dpkg -i packages-microsoft-prod.deb

Step 2 – Installing .NET Core SDK on Ubuntu

sudo apt install apt-transport-https
sudo apt update
sudo apt install dotnet-sdk-6.0

Step 3 – Installing .NET Core Runtime on Ubuntu

sudo apt install apt-transport-https
sudo apt update
sudo apt install dotnet-runtime-6.0

Step 4 – Check .NET Core Version

dotnet --version

You can create your first program by creating a new solution:

That is the code:

using System;

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

It WORKS!!! :)

Possible Error

You might face this error running your first program:

"ApplicationName='/usr/lib/gnome-terminal/gnome-terminal-server', CommandLine='--app-id mono.develop.id0771a7bfd5a6445f82d97a8fe5fc4abc', CurrentDirectory='', Native error= Cannot find the specified file"

I have solved it using this script on the terminal :

cd /usr/lib
sudo mkdir gnome-terminal
cd gnome-terminal
sudo ln -s /usr/libexec/gnome-terminal-server

So this is how I made C# work on my Pop OS Distro.

Hope it helps! :)

Did you find this article valuable?

Support Péter Teszáry by becoming a sponsor. Any amount is appreciated!