Create and Run a Project
Create the Project
To get started, we're going to use the MVVM Avalonia template: Avalonia MVVM Application
(or avalonia.mvvm
in the CLI).
- Rider
- Visual Studio
- Visual Studio Code
- Command Line
-
On the Rider startup screen, select New Solution to bring up the
New Solution
Wizard. If you have installed the Avalonia Templates, then you will see three options.- Avalonia .NET App: A template for desktop apps (Windows, macOS & Linux) that uses code-behind rather than MVVM.
- Avalonia .NET MVVM App: A template for desktop apps (Windows, macOS & Linux) that uses MVVM (by default with RxUI).
- Avalonia Cross-Platform Application: A template for all supported platforms (Windows, macOS, Linux, iOS, Android and WASM). This template requires additional workloads.
-
In the sidebar, scroll down and select
Avalonia .NET MVVM App
-
Type
GetStartedApp
in the Solution Name field -
Click Create
The template will create a new solution and project.


- In Visual Studio, click Create a new project.
- Type
Avalonia
in the search box. - Click Avalonia Application then click Next.

-
Name the project
GetStartedApp
, and click Create. -
The next screen allows selecting the platforms you wish to target: click Desktop then click Next.
-
The next screen allows selecting a design pattern: click ReactiveUI then click Create.
The template will create a new solution and two new projects. GetStartedApp
is the main project that is shared between each platform. GetStartedApp.Desktop
is the platform-specific project for the desktop platform.
- Bring up the Command Palette using
⇧ ⌘ P
and then type ".NET" and find and select the .NET: New Project command.

- After selecting the command, you'll need to choose the project template. Choose Avalonia MVVM app.

- Name the project G
etStartedApp
, and press enter.

- You'll need to provide a path for where the project should be created. Do this, and then press Create project

Run the command:
dotnet new avalonia.mvvm -o GetStartedApp
This will create a new folder called GetStartedApp
containing the new project.
Run the Project
We're now ready to run the project!
- Rider
- Visual Studio
- Visual Studio Code
- Command Line
Press the Run button in the Rider toolbar:
Right-click on the GetStartedApp.Desktop
project and select Set as Startup Project.
Hit F5
to run the project.
- Hit
F5
to run the project and SelectC#
as the debugger

- Select C#: GetStartedApp Demo to launch the application with the debugger connected.
Go into the GetStartedApp
directory and run:
dotnet run
The solution will build and run.
You should now be running your first Avalonia application!

