avalonia docs

Creating the Project

Visual Studio

The easiest way to get started with Avalonia from Visual Studio is to install the extension from the Visual Studio Marketplace. Once that is installed, you can create an Avalonia MVVM application:

New Project Dialog

  1. Start Visual Studio
  2. Select "Create a new project" from the start window or File -> New -> Project from the main menu
  3. Search for "Avalonia" and select "Avalonia MVVM Application"
  4. Click "Next"
  5. Enter "Todo" as the Project name
  6. Click "Create"


First install the Avalonia templates for .NET Core by following the instructions here.

Now you can create the application from the template:

dotnet new avalonia.mvvm -o Todo -n Todo

Project structure

The newly created project will be pre-filled with a number of files and directories:

 |- App.axaml
 |- App.axaml.cs
 |- Assets
 |   |- avalonia-logo.ico
 |- Models 
 |- nuget.config 
 |- Program.cs
 |- Todo.csproj
 |- ViewLocator.cs
 |- ViewModels
 |   |- MainWindowViewModel.cs
 |   |- ViewModelBase.cs
 |- Views
 |   |- MainWindow.axaml
 |   |- MainWindow.axaml.cs

You can see there are directories for each of the concepts in the MVVM pattern (models, views and view models) as well as couple of other files and directories:


.xaml file or .axaml file?

In this tutorial we will use the .axaml file extension for XAML files which is what will be created by the Visual Studio extension. If you're using the .NET Core CLI, the extension will be .xaml. See the Intro to XAML page for information on why this happens.