Getting Started with .NET Core on Arch Linux

Hello Internet! Today, we will try to develop and run .NET Core Apps on a Macbook running Arch Linux! Because what could go wrong!

(Honestly, this went way better than I thought.)


Before we can start writing .NET Core applications on Linux, we need to install some packages. The Arch Wiki states that to run .NET Core applications, the dotnet-runtime package needs to be installed. Additionally, we will need dotnet-sdk-2.0 from the AUR to be able to develop custom applications.

Besides these packages, I recommend installing Visual Studio Code as text editor. I currently use this as my main text editor and it offers a plugin for C# development. You can download it from the AUR as well and then run it from the terminal by entering the command ‘code’.

Last but not least, if you’re getting started with VS Code as well, you can simplify your progress by using Microsofts cheatsheet (this is targeting windows users, but I’m sure you’ll be fine with it).

To install the plugin, simply use CTRL + Shift + X and search for ‘C#’. You’ll find a package from Microsoft called C# for Visual Studio Code (powered by OmniSharp), which you’ll want to install.

Hello World!

After installing all the mentioned packages and plugins, you’re ready to start developing! You can use the built in terminal from VS Code and create a new project folder. Create a new folder wherever you want and use dotnet new followed by the type of application you’d like to create.

I’ll start with a simple console application by entering dotnet new console. You can see all available options by entering the command without a project type.

This command generates all the neccessary files to get started. The entry point of your project will be program.cs, which is already populated with the source code for a basic ‘Hello World’ - application.

namespace Dotnet
    class Program
        static void Main(string[] args)
            Console.WriteLine("Hello World!");

You can now run your program by entering _dotnet run_ inside your project folder. In this case, this will write 'Hello World!' to the terminal.

One last thing I would like to cover in this post is the possibility to debug C# applications in VS Code.

The installed plugins comes with integrated intellisense and debugging, which makes it very easy to develop apps. As you may be used to from Visual Studio, you can set breakpoints by clicking on the border to the left of the row number.

To debug your application, you can use F5 or the the 'Debug' entries from the menu. If that does not work, you might have the program.cs file open directly, without the project folder. In this case, open the folder in VS Code, since it contains debug configuration.