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
<PackageReference Include="CCSWE.Avalonia.Hosting.Desktop" Version="12.0.7" />
<PackageVersion Include="CCSWE.Avalonia.Hosting.Desktop" Version="12.0.7" />
<PackageReference Include="CCSWE.Avalonia.Hosting.Desktop" />
paket add CCSWE.Avalonia.Hosting.Desktop --version 12.0.7
#r "nuget: CCSWE.Avalonia.Hosting.Desktop, 12.0.7"
#:package CCSWE.Avalonia.Hosting.Desktop@12.0.7
#addin nuget:?package=CCSWE.Avalonia.Hosting.Desktop&version=12.0.7
#tool nuget:?package=CCSWE.Avalonia.Hosting.Desktop&version=12.0.7
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 | Versions 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. |
-
net10.0
- Avalonia.Desktop (>= 12.0.1 && < 13.0.0)
- CCSWE.Avalonia.Hosting (>= 12.0.7)
- Microsoft.Extensions.Hosting (>= 10.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.