AXSG ships multiple install surfaces because different users need different entry points.
Use the umbrella package when you want the normal app-facing install path:
<PackageReference Include="XamlToCSharpGenerator" Version="x.y.z" />
This is the recommended starting point for Avalonia applications.
For Avalonia apps, the package reference alone is not the whole setup. AXSG keeps backend selection explicit, so you also need to:
AppBuilderMinimal project setup:
<ItemGroup>
<PackageReference Include="XamlToCSharpGenerator" Version="x.y.z" />
</ItemGroup>
<PropertyGroup>
<AvaloniaXamlCompilerBackend>SourceGen</AvaloniaXamlCompilerBackend>
</PropertyGroup>
Minimal runtime bootstrap:
using XamlToCSharpGenerator.Runtime;
public static AppBuilder BuildAvaloniaApp() =>
AppBuilder.Configure<App>()
.UsePlatformDetect()
.UseAvaloniaSourceGeneratedXaml();
If you need explicit control over the imported build layer, start from:
<PackageReference Include="XamlToCSharpGenerator.Build" Version="x.y.z" />
Use the .NET tool when you need the standalone language server:
dotnet tool install --global XamlToCSharpGenerator.LanguageServer.Tool --version x.y.z
Use the VS Code extension when you want the bundled editor experience instead of wiring the tool manually.
For the main Avalonia path, a project should have:
AvaloniaXamlCompilerBackend=SourceGen.UseAvaloniaSourceGeneratedXaml() in the app bootstrap pathx:DataType on binding scopes where compiled binding semantics are requiredIf the project already contains hand-written InitializeComponent() methods that call AvaloniaXamlLoader.Load(this), do not leave those methods unconditional when you switch to AXSG.
AXSG generates InitializeComponent(bool loadXaml = true) for class-backed XAML, and normal constructor calls such as InitializeComponent(); are expected to bind to that generated method. A hand-written parameterless overload wins overload resolution and will bypass AXSG output.
Use one of these patterns:
AvaloniaXamlLoader.Load(this) method#if !AXAML_SOURCEGEN_BACKENDRecommended portable pattern:
public MainWindow()
{
InitializeComponent();
}
#if !AXAML_SOURCEGEN_BACKEND
private void InitializeComponent()
{
global::Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(this);
}
#endif
Use the dedicated article for the full explanation of why this works and how it interacts with generated partials:
After installing:
.UseAvaloniaSourceGeneratedXaml() before debugging runtime loading or hot reload.InitializeComponent() wrapper around AvaloniaXamlLoader.Load(this).x:DataType on key views, templates, and themes.