visual-studiovisual-studio-2022avaloniauiavalonia

Avalonia.UI new project in Visual Studio stuck in v11-preview4


When I create a new Avalonia app project, it is created in v11-Preview4, despite there is v11-Preview7 version. How I can create Avalonia project in the latest version in Visual Studio?

When I upgrade that simple Hello World project from preview 4 to preview 7, it wont compile, probably because of breaking changes.


Solution

  • The Version of Avalonia you can select to use when creating a new project is determined by the Project templates installed.

    But updating the Avalonia Extension does not always seem to update the Projects templates installed. So you can have scenarios where there are newer versions but you can't select them as your Project templates don't include them.

    To correct this you can update the templates with the following:

    Run from a command line (.NET 7+):

    dotnet new install Avalonia.Templates
    

    For .NET 6:

    dotnet new --install Avalonia.Templates
    

    This is covered in more depth here: https://github.com/AvaloniaUI/avalonia-dotnet-templates