Avalonia Templates for dotnet new
Перейти к файлу
Tako 140d605aea
Merge pull request #101 from AvaloniaUI/remove-nuget.config-from-xplat-template
Remove the nuget.config from xplat template
2022-08-19 18:16:36 +03:00
script update 2021-10-11 15:22:47 +03:00
templates Remove the nuget.config from xplat template 2022-08-19 18:07:33 +03:00
tests add test for avalonia.xplat 2022-01-03 18:16:31 +02:00
.gitignore add a template that targets both browser and desktop. 2021-12-01 15:24:27 +00:00
Avalonia.Templates.csproj update to latest stable 2022-08-18 13:02:23 +01:00
azure-pipelines.yml use macOS-12 with newer xcode. 2022-08-18 23:36:57 +01:00
nuget.config use azure nightly feed. 2022-08-18 14:19:56 +01:00
readme.md Update readme.md 2022-03-09 13:22:54 +00:00

readme.md

downloads Current stable version

Avalonia Templates for dotnet new

For more information about dotnet new templates see here.

Installing the templates

Run from a command line:

dotnet new -i Avalonia.Templates

The templates should now be available in dotnet:

Templates                              Short Name                 Language    Tags
---------------------------------------------------------------------------------------------------------
Avalonia .NET Core App                 avalonia.app               [C#],F#     ui/xaml/avalonia/avaloniaui
Avalonia .NET Core MVVM App            avalonia.mvvm              [C#],F#     ui/xaml/avalonia/avaloniaui
Avalonia Cross Platform Application    avalonia.xplat             [C#]        ui/xaml/avalonia/avaloniaui
Avalonia Resource Dictionary           avalonia.resource                      ui/xaml/avalonia/avaloniaui
Avalonia Styles                        avalonia.styles                        ui/xaml/avalonia/avaloniaui
Avalonia TemplatedControl              avalonia.templatedcontrol  [C#]        ui/xaml/avalonia/avaloniaui
Avalonia UserControl                   avalonia.usercontrol       [C#],F#     ui/xaml/avalonia/avaloniaui
Avalonia Window                        avalonia.window            [C#],F#     ui/xaml/avalonia/avaloniaui

Note:

By default dotnet CLI would create a C# template,if you want to create F# template you will need to add -lang F# to the end of the command.

Creating a new MVVM Application

MVVM is the recommended pattern for creating Avalonia applications. The MVVM application template uses ReactiveUI to ease building applications with complex interactions.

To create a new MVVM application called MyApp in its own subdirectory, run:

dotnet new avalonia.mvvm -o MyApp

Creating a new Cross-Platform application

To create a new Cross-Platform application in its own subdirectory, run:

dotnet new avalonia.xplat 

Note: This type of template allows you to create an application that will work on Desktop, Browser (preview) and Mobile (iOS & Android) (preview).

Creating a new Application

To create a new barebones application called MyApp in its own subdirectory, run:

dotnet new avalonia.app -o MyApp

Creating a new Window

To create a new Window called MyNewWindow, in the namespace MyApp run:

dotnet new avalonia.window -na MyApp -n MyNewWindow

Creating a new UserControl

To create a new UserControl called MyNewView, in the namespace MyApp run:

dotnet new avalonia.usercontrol -na MyApp -n MyNewView

Creating a new Styles list

To create a new Styles list called MyStyles, run:

dotnet new avalonia.styles -n MyStyles

Creating a new ResourceDictionary

To create a new ResourceDictionary called MyResources, run:

dotnet new avalonia.resource -n MyResources