Runic.Application.Desktop 0.6.0-preview.1

Suggested Alternatives

Runic.Application.Views.Desktop

Additional Details

Renamed to Runic.Application.Views.Desktop in 0.7.0-preview.7. Namespaces are unchanged; replace the package reference.

This is a prerelease version of Runic.Application.Desktop.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Runic.Application.Desktop --version 0.6.0-preview.1
                    
NuGet\Install-Package Runic.Application.Desktop -Version 0.6.0-preview.1
                    
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="Runic.Application.Desktop" Version="0.6.0-preview.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Runic.Application.Desktop" Version="0.6.0-preview.1" />
                    
Directory.Packages.props
<PackageReference Include="Runic.Application.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 Runic.Application.Desktop --version 0.6.0-preview.1
                    
#r "nuget: Runic.Application.Desktop, 0.6.0-preview.1"
                    
#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 Runic.Application.Desktop@0.6.0-preview.1
                    
#: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=Runic.Application.Desktop&version=0.6.0-preview.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Runic.Application.Desktop&version=0.6.0-preview.1&prerelease
                    
Install as a Cake Tool

Runic.Application.Desktop

Present Runic Windows and Views with Runic Desktop: native windows, embedded WebViews or browser presentations, and the Runic platform services.

dotnet add package Runic.Application.Desktop --prerelease

New projects can start with this host: dotnet new runic-app --host desktop.

In a project named MyApp:

using Microsoft.Extensions.DependencyInjection;
using MyApp; // the generated AddRunicViews()
using Runic.Application.Views;
using Runic.Application.Views.Desktop;
using Runic.Desktop;

var services = new ServiceCollection();
services.AddScoped<MainViewModel>();
services.AddRunicViews();
await using var provider = services.BuildServiceProvider();
await using var desktop = await DesktopHost.StartAsync(new DesktopHostOptions());
await using var window = await provider.OpenDesktopWindowAsync<MainWindow, MainViewModel>(
    desktop,
    new DesktopSurfaceOptions { RootFolder = Path.Combine(AppContext.BaseDirectory, "www"), Content = "index.html" },
    host => new MainWindow(host),
    new DesktopWindowOptions { Width = 800, Height = 600 });
window.Presentation.WaitForClose();

public sealed partial class MainWindow(DesktopBridgeWindow<MainViewModel> host)
    : RunicWindow<MainViewModel>(host.ViewModel), IAsyncDisposable
{
    public DesktopWindow Presentation => host.Presentation;
    public ValueTask DisposeAsync() => host.DisposeAsync();
}

Entry points

  • OpenDesktopWindowAsync<TWindow, TViewModel> creates the Window's DI scope, resolves its ViewModel, opens a DesktopSurface and its presentation, and attaches the generated Bridge.
  • DesktopBridgeWindow<TViewModel> owns that scope, surface, and attachment. It exposes ViewModel, Surface, Presentation, and CloseAsync, which stops new operations and waits for accepted ones before releasing the scope.
  • DesktopBridgeTransport connects a DesktopSurface to a WindowContentSession directly, for applications that compose a surface themselves.

The surface owns authenticated browser or embedded WebView sessions and removable capability bindings; the application Window owns its ViewModel scope and logical View lifetimes. DesktopHostOptions and DesktopWindowOptions select the browser or embedded backend; the Runic Desktop guide lists the native prerequisites for each platform.

The package's build targets copy runic-desktop-views.js into www/. Load webui.js (served by the surface) and runic-desktop-views.js before the generated client in index.html. The adapter uses the same host-neutral client contract as the CS-WebUI adapter, and its build defaults match Runic.Application.CsWebUi, so AddRunicViews() is generated in <ProjectName>.RunicBridgeComposition.

The First Window on Runic Desktop example is a complete application. See the host selection guide to choose between this host and CS-WebUI.

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 (1)

Showing the top 1 NuGet packages that depend on Runic.Application.Desktop:

Package Downloads
Runic.Application.Wpf

Optional WPF child WebView presentation for existing Runic ViewModels.

GitHub repositories

This package is not used by any popular GitHub repositories.