The easiest way to get started with Avalonia from Visual Studio is to install the extension from the Visual Studio Marketplace.
Installing the extension will add a couple of project templates to Visual Studio, under the
Avalonia heading. The installed templates are:
- Avalonia Application: This will create a barebones Avalonia application
- Avalonia MVVM Application: This will create an application that uses the Model-View-ViewModel pattern with ReactiveUI
By default these application templates will dual-target .NET Framework 4.6.1 and .NET Core 2.0.
Once you have an Avalonia application, two item templates will become available:
First install the Avalonia templates for .NET Core by following the instructions here.
This will add a couple of project templates to
avalonia.app: This will create a barebones Avalonia application
avalonia.app.mvvm: This will create an application that uses the Model-View-ViewModel pattern with ReactiveUI
To create a project using the templates use
dotnet new avalonia.app -o MyApp
avalonia.app is the name of the template to use and
MyApp is the name of the project to create.
Once you have an Avalonia application, there are two item templates available: