Which is the better option for running C# programs in Ubuntu?

  • using Mono and compiling in the terminal
  • Microsoft Visual Studio Code
  • Microsoft .NET SDK.

Arguably this question might have been opinion-based when it was asked in 2017, but it's not opinion-based anymore. MonoDevelop was a good IDE for C# in Ubuntu when this question was asked, but it has been dropped from the default Ubuntu repositories. Visual Studio Code assumes that you have Windows installed and you don't mind manually downloading and installing a lot of software that Microsoft recommends in order to get C# to work in Visual Studio Code. The dotnet-sdk snap package is all you need to install in order to start coding with C# in all currently supported versions of Ubuntu.

The terminal and MonoDevelop (monodevelop) from the default Ubuntu repositories is maybe all you need, and Visual Studio Code doesn't live up to its full potential until you install lots of software to go with it. It's amazing how fast Visual Studio Code can chew up a gigabyte of disk space when it turns your Ubuntu into a Windows development environment.

If you don't stop there you need to grant root access to some fancy development software to keep going. Visual Studio Code treats every platform as if it's Windows, so sometimes the extra software you installed doesn't work. Visual Studio Code doesn't warn you about this, so you need to install the software in order to find out if it works or not. Finally you have a Microsoft epiphany moment when you realize that Visual Studio Code is a fancy code editor, not an IDE, and you need to buy the latest version of Windows and install Visual Studio in it. All this is optional, so in Ubuntu 17.10 and earlier you're better off starting with the lightweight MonoDevelop IDE and see how it goes.

MonoDevelop can be installed from the default Ubuntu repositories in Ubuntu 17.10 and earlier. This link tells how to run C# programs from the terminal and in MonoDevelop: How do I install Mono for 17.10?


C# is open source and cross platform now that Microsoft has released a version of .NET Core. To install .NET Core in Ubuntu open the terminal and type:

sudo snap install dotnet-sdk --classic
sudo snap alias dotnet-sdk.dotnet dotnet # to run dotnet-sdk type dotnet

Run these commands to build and run an example C# Hello World console app from the terminal:

cd ~
mkdir C#_Projects
cd C#_Projects
mkdir HelloWorld
cd HelloWorld
dotnet new console
dotnet build --output ./build_output  
dotnet ./build_output/HelloWorld.dll

Results of dotnet ./build_output/HelloWorld.dll

Hello, World!