using System.Net;using System.Net.Sockets;namespace Lilith.DesktopWeb2App;internal static class TcpPort{ internal static int FindFree() { var listener = new TcpListener(IPAddress.Loopback, 0); listener.Start(); int port = ((IPEndPoint)listener.LocalEndpoint).Port; listener.Stop(); return port; }}
Documentation
Lilith.DesktopWeb2App (Version 5)
Windows desktop shell (WebView2 + local Kestrel) hosting Lilith.RazorWebGui for Version 5.
dotnet run --project Lilith.DesktopWeb2App.csproj
Requires [WebView2 Runtime](https://developer.microsoft.com/microsoft-edge/webview2/).