Open a native window from an HTML string.
dotnet add package RecursiveAI.OneAppRequires .NET 10 (net10.0); .NET 9 and earlier aren’t supported.
Runs on Linux with Vulkan (X11 or Wayland), macOS on Apple silicon, and Windows.
using OneApp; var html = """ <style>h1 { color: #2457a7; }</style> <h1>Hello, desktop!</h1> """; using var app = AppHost.Create(new AppOptions(html) { Title = "Hello", Width = 400, Height = 180 }); app.Run();
Paste the code above into Program.cs of a new dotnet new console project and dotnet run, or unzip the example and dotnet run.
The window shows Hello, desktop! in blue. It doesn’t print to the terminal.

Close the window to return from app.Run(). If the window can’t draw on Linux, check the Vulkan driver; OneApp reports a PresenterUnavailableException when the required presenter isn’t available.
Variations
Start with no stylesheet. Replace the html declaration with this line to see the heading in the default style:
var html = "<h1>Hello, desktop!</h1>";Related recipes
- Automate UI tests for a C# desktop app
- Show desktop notifications from a C# tray app
- Open a native file dialog in a C# desktop app
The short answer
You can use HTML for a C# desktop app’s layout and CSS for its appearance. Give the markup to AppOptions, create an AppHost, and call Run() to keep the window open. The HTML in this example is part of Program.cs: there’s no separate stylesheet, web server, browser download, or build step for the markup.
How do I create a desktop app with HTML and CSS?
Start with one visible element, such as a heading, and one rule so you can tell the style was applied. The <h1> gives the page a heading. The h1 selector in <style> applies a text color to it. To change the text, edit the HTML; to change the text color, edit the CSS. To change the title bar or startup size, edit AppOptions instead. Those options belong to the native window, not to the page inside it.
When you build something interactive, you can keep event handling in C#. OneApp’s template system also lets you split a component into an HTML template, an optional stylesheet, and a partial C# class with the same name. The markup compiler checks bindings, events, and CSS properties at build time. A static about window doesn’t need any of that structure; a form with several controls and state can use it to separate layout from behavior. See components in a native window for how state and events are wired.
Can I turn an existing HTML page into a desktop app?
Try a small piece of its markup first. OneApp draws the page natively rather than embedding a browser, so moving a stylesheet and a few HTML elements is different from loading a whole website as-is. A page that relies on browser JavaScript for every interaction needs its behavior wired up in C#. Check the CSS features you depend on and test the result in an actual window. Use the platform table to check the drawing backend on the operating systems you ship to: Linux uses Vulkan, macOS on Apple silicon uses Metal, and Windows can also draw with a CPU rasterizer through GDI.