PlantOps is a deliberately small example showing how an existing .NET Windows Forms application can introduce WinUI 3 incrementally rather than being completely rewritten. It assumes the application already runs on modern .NET; runtime migration is outside this example.
Open either solution independently. Select CNC Mill 04, then choose Schedule maintenance. Both versions open the same WinForms maintenance dialog. Only the equipment details area changes.
| Before | After |
|---|---|
![]() |
![]() |
Before/
PlantOps.Before.sln
PlantOps/ WinForms application and equipment details
PlantOps.Core/ Equipment, repository and event arguments
After/
PlantOps.After.sln
PlantOps/ Same WinForms application, plus island hosting
PlantOps.Core/ Independent copy of the same domain code
PlantOps.WinUI/ Compiled XAML equipment status UserControl
- Windows 11, x64. The application minimum is Windows build 22000.
- .NET SDK 10.0.400 or a later patch in that feature band.
global.jsonuseslatestPatch. - Visual Studio 2026 with .NET desktop development, WinUI development tooling and Windows SDK 10.0.26100.0. Use a current serviced Visual Studio that supports the installed .NET SDK. CLI builds work with the installed SDK/tooling too.
- NuGet access for the initial restore.
Both UI projects target net10.0-windows10.0.26100.0; the Core projects target net10.0. After uses Microsoft.WindowsAppSDK 2.4.0, with WinUI package 2.3.6 and SDK BuildTools 10.0.26100.4654. Each packages.lock.json records the full dependency graph. The validation record lists the tested toolchain versions.
Open Before/PlantOps.Before.sln, set PlantOps as the startup project, choose Debug / x64, and press F5.
Or, from the repository root in PowerShell:
dotnet build Before/PlantOps.Before.sln -c Debug -p:Platform=x64
& .\Before\PlantOps\bin\x64\Debug\net10.0-windows10.0.26100.0\PlantOps.exeOpen After/PlantOps.After.sln, set PlantOps as the startup project (not PlantOps.WinUI), choose Debug / x64, and press F5. Use the Project launch target if Visual Studio offers launch profiles.
dotnet build After/PlantOps.After.sln -c Debug -p:Platform=x64
& .\After\PlantOps\bin\x64\Debug\net10.0-windows10.0.26100.0\win-x64\PlantOps.exeClose a running copy before rebuilding its output directory. After is unpackaged and carries the Windows App SDK runtime beside the executable; there is no separate MSIX installation or Windows App Runtime bootstrap installer for this demo. Normal builds still require the .NET 10 Desktop Runtime, supplied by the development prerequisites.
To produce a folder that also carries .NET:
dotnet publish After/PlantOps/PlantOps.csproj -c Release -p:Platform=x64 -r win-x64 --self-contained true -p:PublishTrimmed=false -o artifacts/AfterDistribute the entire output folder, including native DLLs, PRI files, and the PlantOps.WinUI resource directory. This repository does not provide an installer or single-file publishing configuration. Validate deployment on a clean target machine before distribution.
Navigation, equipment selection, MainForm, the domain objects, status bar and ScheduleMaintenanceForm remain WinForms/existing C#. The two Core copies and maintenance forms are intentionally identical and neither solution references the other directory.
- Keep the existing
MaintenanceRequestedevent andRequestMaintenance(Equipment)handler. - Add a WinUI class library containing
EquipmentStatusPanel. - Initialize the Windows App SDK, dispatcher and XAML environment on the existing STA thread.
- Host the panel beneath a WinForms control HWND and resize it with that control.
- Pass the selected
Equipmentinto the panel and route its maintenance event back to the existing handler.
WinForms layouts are built in C# constructors deliberately. There are no designer-backed forms to edit visually; inspect the constructors to follow the layout. WinUI uses compiled XAML with generated metadata.
- Before equipment details
- After equipment XAML and data/event code
- WinForms island host: HWND creation, sizing, focus, recreation and disposal
- Startup, XAML metadata/resources, and message translation
- Existing application handler and maintenance dialog
- Architecture and official references
.\build\Verify.ps1This restores with locked dependencies and builds each solution separately in Release/x64. Add -RunHostChecks on an interactive Windows desktop to exercise the real After island, all selections, owned dialogs/cancellation, focus restoration, resizing, HWND recreation and disposal. The check opens and closes test windows; its report is written to artifacts/host-verification.txt.
See validation results and verification checklist for test coverage and limitations.
Five fixed sample machines, no persistence or live telemetry. Scheduling shows a confirmation and changes the status message; it does not change service dates. Other navigation destinations are placeholders. Light theme, Windows 11 and x64 are the intended scope. The minimum window size assumes adequate desktop space at the chosen scaling. Mixed-monitor DPI transitions, additional scaling settings, screen-reader testing and a clean-machine deployment remain manual validation items.

