Use this guide when you need to decide between the umbrella package, lower-level compiler packages, runtime-only packages, or the standalone tooling artifacts.
Most Avalonia applications should start with:
XamlToCSharpGeneratorThat gives you:
Use the umbrella package unless you have a concrete reason to separate compiler, runtime, or tooling layers.
For the normal Avalonia app path, the minimum supported setup is:
XamlToCSharpGenerator<AvaloniaXamlCompilerBackend>SourceGen</AvaloniaXamlCompilerBackend>.UseAvaloniaSourceGeneratedXaml() on AppBuilderFor class-backed XAML, AXSG generates InitializeComponent(bool loadXaml = true). A hand-written parameterless InitializeComponent() wrapper still intercepts constructor calls such as InitializeComponent();, so you should either remove it or rely on AXSG IL weaving to rewrite supported legacy loader calls during the build.
Use the guarded fallback pattern instead when the same file must support both AXSG and non-AXSG builds:
If you need a custom project item group, use XamlSourceGenInputItemGroup and mirror your XAML items into that group. Do not override XamlSourceGenAdditionalFilesSourceItemGroup for Avalonia consumers; the build package always projects AXSG Avalonia inputs into Roslyn AdditionalFiles as AvaloniaXaml.
Pick XamlToCSharpGenerator.Build when:
Pick the lower-level compiler packages when you are extending AXSG itself or embedding it:
XamlToCSharpGenerator.CompilerXamlToCSharpGenerator.CoreXamlToCSharpGenerator.Framework.AbstractionsXamlToCSharpGenerator.AvaloniaXamlToCSharpGenerator.NoUiPick runtime packages directly when you are hosting generated output or hot reload/runtime services:
XamlToCSharpGenerator.RuntimeXamlToCSharpGenerator.Runtime.CoreXamlToCSharpGenerator.Runtime.AvaloniaPick tooling packages when you need editor/language infrastructure:
XamlToCSharpGenerator.LanguageServiceXamlToCSharpGenerator.LanguageServer.ToolXamlToCSharpGenerator.Editor.Avaloniawieslawsoltes.axsg-language-server| Scenario | Recommended artifacts |
|---|---|
| Standard Avalonia app | XamlToCSharpGenerator |
| Custom compiler host | Compiler, Core, Framework.Abstractions, plus a profile package |
| Runtime host integration | Runtime.Core and Runtime.Avalonia |
| External editor integration | LanguageServer.Tool |
| In-app AXAML editor | Editor.Avalonia plus LanguageService |
| VS Code authoring | VS Code extension, optionally alongside the standalone tool |