Avalonia UI on Ubuntu: Getting Started

carlos487

Carlos Fabara

Posted on June 27, 2020

Avalonia UI on Ubuntu: Getting Started

Avalonia UI is a cross-platform UI framework available for Dotnet Core. It is a project part of the .Net Foundation. Its main appeal is to provide the ability to create desktop applications for Windows, Linux and MacOS with a single code base.

In this tutorial we will see how to install the Avalonia templates and create a blank application.

Installing templates

The first thing we need to do is installing the Avalonia Templates so the dotnet new command could use them when creating new applications.

You need to go to the following Github Repository Avalonia Templates for dotnet new and download the zip version. Alternatively, you could clone it to your machine if you have git installed.

Avalonia templates Github Repo

After you have unzipped the file in the location you prefer. It is needed to run the following command. Keep in mind the path you need to use is the route to the unzipped templates



dotnet new --install [path-to-templates-folder]


Enter fullscreen mode Exit fullscreen mode

Tip: An easy way to add the folder path to the command line is to drag and drop the folder from the File Explorer

Drag and drop folder to the terminal

Creating an Avalonia application

The command executed on the previous step adds a few more templates to the dotnet new command.

There are two project templates added are the following:

  • avalonia.app: To create a barebones Avalonia application
  • avalonia.mvvm: To create an application that uses the Model-View-ViewModel pattern with ReactiveUI

To create a new application you need to run the following command:



dotnet new avalonia.app -o MyApp


Enter fullscreen mode Exit fullscreen mode

Where MyApp is the name of the application we are creating.

Running the application

To run the application you need to get into the MyApp folder



cd MyApp


Enter fullscreen mode Exit fullscreen mode

and then run the app with the dotnet CLI



dotnet run


Enter fullscreen mode Exit fullscreen mode

The result will be the following as a blank app shows on screen.

Blank Avalonia App

I hope you find this useful. In following entries we will continue exploring the Avalonia UI framework.

💖 💪 🙅 🚩
carlos487
Carlos Fabara

Posted on June 27, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related