Build and run locally

Build the Web assets, native host, and isolated WinUI preview.

Windows · WinUI preview

Build the Web assets, native host, and isolated WinUI preview.

These commands require a desktop source checkout that contains the full src-winui implementation. They do not apply to a website-only checkout. Confirm that your branch includes the Native Host, WinUI Core, and shared Web views.

Requirements

The current project files specify .NET 10, Windows SDK 10.0.26100, x64, and Windows App SDK 1.8. These are source build settings, not validated minimum end-user requirements. You also need Node.js/npm, a Rust Windows toolchain, C++/Windows SDK build dependencies, and WebView2 for the shared views. Use the versions in the checked-out project and lockfiles.

Build shared Web assets

From the desktop repository root:

npm ci
pwsh -NoProfile -File scripts/build-winui-web.ps1 -RepoRoot (Get-Location).Path

The script runs type checks and Vite, collects immersive.html and lyric-capsule.html dependencies from the manifest, copies them to WinUI Assets/web, and writes a build stamp. Do not manually overlay an old dist directory.

Build the native host and UI

cargo build --manifest-path src-tauri/Cargo.toml --bin ofplayer-native-host
dotnet build src-winui/OFPlayer.WinUI/OFPlayer.WinUI.csproj -p:Platform=x64

The Web, Rust, and WinUI builds are separate checks. Passing one does not validate the others.

Use an isolated preview directory

$env:OFPLAYER_WINUI_DATA_ROOT = Join-Path (Get-Location) '.preview-data'
$env:OFPLAYER_NATIVE_HOST_PATH = Join-Path (Get-Location) 'src-tauri/target/debug/ofplayer-native-host.exe'
& './src-winui/OFPlayer.WinUI/bin/x64/Debug/net10.0-windows10.0.26100.0/win-x64/OFPlayer.WinUI.exe'

Without an override, the current preview uses ofplayer-winui-preview under local app data. Check Settings → Library & Storage → Data location and reset for the actual path. Two hosts must not use the same directory at once. Do not share one database between old Tauri and WinUI clients or bypass production-directory safeguards for a preview.

Validate the build

dotnet run --project src-winui/OFPlayer.WinUI.Core.Tests/OFPlayer.WinUI.Core.Tests.csproj
cargo test --manifest-path src-tauri/Cargo.toml --test native_host_protocol

Core tests cover models and policy. Protocol tests exercise communication with a real host process. Also test the native window’s import, playback, grouped navigation, immersive view, capsule, and device behavior. A Vue browser check cannot validate XAML focus, window drag, or Windows media controls.

Before publishing, verify that the output includes the release host, PRI resources, and runtime dependencies. Clean-machine installation, signing, upgrades, data retention, and recovery from failed updates require separate release acceptance.