Microsoft.WebUI 0.0.26

Prefix Reserved
dotnet add package Microsoft.WebUI --version 0.0.26
                    
NuGet\Install-Package Microsoft.WebUI -Version 0.0.26
                    
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="Microsoft.WebUI" Version="0.0.26" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsoft.WebUI" Version="0.0.26" />
                    
Directory.Packages.props
<PackageReference Include="Microsoft.WebUI" />
                    
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 Microsoft.WebUI --version 0.0.26
                    
#r "nuget: Microsoft.WebUI, 0.0.26"
                    
#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 Microsoft.WebUI@0.0.26
                    
#: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=Microsoft.WebUI&version=0.0.26
                    
Install as a Cake Addin
#tool nuget:?package=Microsoft.WebUI&version=0.0.26
                    
Install as a Cake Tool

Microsoft.WebUI

High-performance server-side rendering for .NET — no JavaScript runtime required.

WebUI separates static and dynamic content at build time into a binary protocol that enables fast rendering in any host language. This package provides .NET bindings to the WebUI native rendering engine.

Quick Start

using Microsoft.WebUI;

// Load pre-compiled protocol binary (from `webui build`)
using var protocol = new Protocol(File.ReadAllBytes("app.webui"));
using var handler = new WebUIHandler("webui");

// Render with different state each time
var html = handler.Render(protocol, """{"user": "Alice"}""", "index.html", "/");

Protocol is thread-safe and owns the decoded protocol plus reusable indices. Keep it alive for the server lifetime. Refer to the WebUI documentation for the available plugin identifiers.

Client-Side Navigation (Partial Responses)

When the client navigates via the WebUI Router, your server returns a JSON partial instead of full HTML. Use RenderPartial — one call produces the complete response with state, templates, inventory, path, and matched route chain:

app.MapGet("/users/{id}", (HttpContext ctx, string id) =>
{
    var state = new { name = GetUser(id).Name };
    var stateJson = JsonSerializer.Serialize(state);

    if (ctx.Request.Headers.Accept.Contains("application/json"))
    {
        // Client-side navigation — return JSON partial (no assembly required)
        var inventoryHex = ctx.Request.Headers["X-WebUI-Inventory"].FirstOrDefault() ?? "";
        var json = protocol.RenderPartial(stateJson, "index.html", ctx.Request.Path, inventoryHex);
        return Results.Content(json, "application/json");
    }

    // Full SSR — return complete HTML page
    var html = handler.Render(protocol, stateJson, "index.html", ctx.Request.Path);
    return Results.Content(html, "text/html");
});

The response is a JSON string — pipe it directly to the HTTP response. No deserialization needed.

protocol.RenderComponentTemplates(tags, inventoryHex) returns the template payload for on-demand component loading. protocol.Tokens() returns CSS token names in build order.

Progressive Streaming

WebUIHandler.StreamResponse returns one host-owned, single-driver session:

using var session = handler.StreamResponse(protocol, "index.html", "/");
StreamingStep step = session.Start(initialStateJson);

while (true)
{
    await response.Body.WriteAsync(step.Bytes);
    await response.Body.FlushAsync();
    if (step.Done) break;

    if (step.Boundary is BoundaryDescriptor boundary)
    {
        string state = await LoadBoundaryStateAsync(boundary);
        step = session.Resume(
            boundary.InstanceId,
            state,
            BoundaryMode.Final);
    }
    else
    {
        step = session.Advance();
    }
}
Member Result
Start(stateJson) Shell bytes through the first descriptor or terminal
Resume(instanceId, stateJson, mode) Only the pending occurrence's bytes through its checkpoint
Advance() Following parent bytes through the next descriptor or terminal
Update(instanceId, patchJson) Projected state bytes for an updatable occurrence

A descriptor requires Resume; no descriptor with Done == false requires Advance; Done == true means complete. Resume is boundary-only and Advance carries following parent or tail bytes, so no sibling boundary is needed. Update is valid between an occurrence's Resume and Advance.

Installation

dotnet add package Microsoft.WebUI

The managed package depends on all supported Microsoft.WebUI.Runtime.<rid> packages. NuGet restores those native runtime packages transitively, and .NET selects the matching runtimes/<rid>/native asset for your platform.

Supported Platforms

Runtime Package
Windows x64 Microsoft.WebUI.Runtime.win-x64
Windows ARM64 Microsoft.WebUI.Runtime.win-arm64
Linux x64 Microsoft.WebUI.Runtime.linux-x64
Linux ARM64 Microsoft.WebUI.Runtime.linux-arm64
macOS x64 Microsoft.WebUI.Runtime.osx-x64
macOS ARM64 Microsoft.WebUI.Runtime.osx-arm64

Package Metadata

Packed NuGet artifacts include this README, repository metadata, Source Link, the SPDX MIT license expression with license acceptance required, release notes links, discoverability tags, the © Microsoft Corporation. All rights reserved. notice, and .snupkg symbol packages. Release workflows stage .nupkg and .snupkg files for downstream signing and publishing. NuGet.org publishing is not automatic until an approved Microsoft-certificate signing path is available for .nupkg packages. Before publishing, staged packages and Authenticode-signable contents must be signed with a Microsoft certificate through the approved signing process.

Manual Native Library Path

If you need to point to a custom build of the native library:

export WEBUI_LIB_PATH=/path/to/directory   # directory containing libwebui_ffi.*
# or
export WEBUI_LIB_PATH=/path/to/libwebui_ffi.dylib  # direct file path

Building from Source

# Build the native FFI library
cargo build --release -p microsoft-webui-ffi

# Build and test the .NET package
cargo xtask dotnet

License

MIT. NuGet package metadata uses © Microsoft Corporation. All rights reserved.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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
0.0.26 106 8/26/2026
0.0.25 106 8/19/2026
0.0.23 97 8/11/2026
0.0.22 98 8/5/2026
0.0.18 106 7/30/2026