CCSWE.Avalonia.Hosting.Desktop 12.0.7

dotnet add package CCSWE.Avalonia.Hosting.Desktop --version 12.0.7
                    
NuGet\Install-Package CCSWE.Avalonia.Hosting.Desktop -Version 12.0.7
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CCSWE.Avalonia.Hosting.Desktop" Version="12.0.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CCSWE.Avalonia.Hosting.Desktop" Version="12.0.7" />
                    
Directory.Packages.props
<PackageReference Include="CCSWE.Avalonia.Hosting.Desktop" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CCSWE.Avalonia.Hosting.Desktop --version 12.0.7
                    
#r "nuget: CCSWE.Avalonia.Hosting.Desktop, 12.0.7"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CCSWE.Avalonia.Hosting.Desktop@12.0.7
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CCSWE.Avalonia.Hosting.Desktop&version=12.0.7
                    
Install as a Cake Addin
#tool nuget:?package=CCSWE.Avalonia.Hosting.Desktop&version=12.0.7
                    
Install as a Cake Tool

CCSWE.Avalonia.Hosting.Desktop

Bootstrap an Avalonia classic-desktop app (Windows, Linux, macOS) on the .NET Generic Host — DI, hosted-service lifecycle, configuration, and logging — without the hand-written Avalonia-to-host plumbing.

[STAThread]
public static void Main(string[] args)
{
    var builder = DesktopApplication.CreateBuilder<App>(args);
    builder.Services.AddSingleton<IMyService, MyService>();
    builder.Services.AddHostedService<MyBackgroundWorker>();
    builder.Build().Run(args);
}

// The Avalonia XAML previewer needs a parameterless AppBuilder-returning method.
public static AppBuilder BuildAvaloniaApp() => DesktopApplication.ConfigureAppBuilder<App>();

Run() starts the hosted services, runs the Avalonia main loop, and stops the host on exit (cancelling background services). Your App implements IServiceProviderAccessor (from CCSWE.Avalonia.Hosting) to receive the built provider before OnFrameworkInitializationCompleted. All types share the CCSWE.Avalonia.Hosting namespace, so a single using CCSWE.Avalonia.Hosting; is all you need.

See the repository for full usage.

MIT © Cory Charlton / CCSWE.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
12.0.7 150 6/23/2026
12.0.6 110 6/23/2026
12.0.5 116 6/23/2026
12.0.4 268 6/9/2026
12.0.3 111 6/8/2026
12.0.1 112 6/8/2026