Runic.Application.CsWebUi 0.6.0-preview.1

Suggested Alternatives

Runic.Application.Views.CsWebUi

Additional Details

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

This is a prerelease version of Runic.Application.CsWebUi.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Runic.Application.CsWebUi --version 0.6.0-preview.1
                    
NuGet\Install-Package Runic.Application.CsWebUi -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.CsWebUi" 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.CsWebUi" Version="0.6.0-preview.1" />
                    
Directory.Packages.props
<PackageReference Include="Runic.Application.CsWebUi" />
                    
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.CsWebUi --version 0.6.0-preview.1
                    
#r "nuget: Runic.Application.CsWebUi, 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.CsWebUi@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.CsWebUi&version=0.6.0-preview.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Runic.Application.CsWebUi&version=0.6.0-preview.1&prerelease
                    
Install as a Cake Tool

Runic.Application.CsWebUi

Present Runic Windows and Views with CS-WebUI. This is the default host of the runic-app project template.

dotnet add package Runic.Application.CsWebUi --prerelease
public sealed partial class MainWindow(CsWebUiBridgeWindow<MainViewModel> host)
    : CsWebUiWindow<MainViewModel>(host);

var services = new ServiceCollection();
services.AddScoped<MainViewModel>();
services.AddRunicViews(); // generated in <ProjectName>.RunicBridgeComposition
using var provider = services.BuildServiceProvider();
using var window = provider.OpenWindow<MainWindow, MainViewModel>(host => new MainWindow(host));
window.SetRootFolder(Path.Combine(AppContext.BaseDirectory, "www"));
window.Show("index.html");
WebUiApplication.Wait();

OpenWindow creates a DI scope, resolves the Window's ViewModel, constructs the Window, and attaches its generated Bridge; the Window owns the native window, scope, and attachments until it is disposed or CloseAsync drains its accepted operations. CsWebUiWindow<TViewModel> forwards SetRootFolder, SetSize, Show, ShowWebView, StartServer, CloseAsync, and disposal to its Host, a CsWebUiBridgeWindow<TViewModel>; Host.NativeWindow exposes the underlying WebUiWindow.

What Show opens

Show uses WebUI's recommended presentation: an installed browser in app mode (Chrome, Edge and other Chromium-based browsers work best; Firefox works without app mode), then the system default browser, then the platform WebView. ShowWebView always uses the WebView: the Edge WebView2 Runtime on Windows, GTK 3 with WebKitGTK 4.1 on Linux, or WKWebView on macOS. For native windows and platform services, use Runic.Application.Desktop instead.

Set RUNIC_APPLICATION_SERVE_ONLY=1 to start the local server without opening anything. Show and ShowWebView then write RUNIC_APPLICATION_URL=<url> to standard output and keep serving until a line is read from standard input or the process ends, so a test harness or remote browser can drive the unchanged application.

Build output

The package's build targets copy runic-cswebui.js into www/ next to the built frontend. Load webui.js (served by WebUI) and runic-cswebui.js before the generated client in index.html. The script adapts window.webui to the generated client's transport contract.

A window-local CreateBridgeSession() retains one native binding for each route name and swaps the active managed handler as Views change; an inactive route returns disconnected. CS-WebUI cannot remove a native route registration before its window closes. Retained page references reuse routes; new page identities still add routes.

See the Runic.Application package guide for Windows, Views, generated clients, and build properties.

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.