WinForms on Linux
Why plain WinForms can’t do it
System.Windows.Forms ships only in the Windows Desktop runtime. On Linux there is no
Microsoft.WindowsDesktop.App shared framework to resolve against, so a net10.0-windows project
doesn’t merely fail to run — dotnet build refuses it. The assembly is a wrapper over user32.dll
and GDI+, and neither exists here.
The three things people usually try:
- Mono’s
System.Windows.Forms. A real reimplementation, and the reason old forum threads say this works. It was built for the .NET Framework era, was never carried into modern .NET, and is not a target you can adopt today. - Wine. Runs the Windows binary rather than porting it. Workable as a stopgap; it means shipping a Windows executable plus a compatibility runtime, with approximate host integration.
System.Drawing.Commonon Linux. Even for non-UI drawing code this stopped being an option: it has thrownPlatformNotSupportedExceptionoff Windows since .NET 7 unless you set a now-removed compatibility switch.
What Majorsilence.Forms does instead
It reimplements the WinForms API on top of SkiaSharp and hosts it in an Avalonia window. On Linux
that means a normal, native X11 application — a real window in your window manager, real input, GPU
compositing where available, and a plain net10.0 build with no -windows suffix anywhere.
dotnet new install MajorsilenceForms.Templates
dotnet new majorsilenceforms
dotnet run
That is the whole setup on a stock Ubuntu box with the .NET SDK installed. The same source builds and runs unchanged on Windows and macOS.
What actually works on Linux
| Area | On Linux |
|---|---|
| Windowing, input, HiDPI | Native, via the Avalonia X11 backend. Runs under XWayland on Wayland sessions. |
| Rendering | SkiaSharp, GPU-accelerated — the same paint code as Windows and macOS, so controls look identical |
| Fonts and text | SkiaSharp resolves system fonts through fontconfig; Majorsilence.Forms.Drawing.Common also bundles a fallback set, so text renders even on a minimal image with no fonts installed |
GDI+ / System.Drawing code |
Replaced by Majorsilence.Forms.Drawing — Bitmap, Font, Pen, Brush, Region, Drawing2D, Imaging, and EMF/WMF playback |
| Common dialogs | OpenFileDialog, SaveFileDialog, FolderBrowserDialog, ColorDialog, FontDialog work through the backend’s native dialogs |
| Printing | PrintDocument renders through Skia to PDF rather than to a print driver — the same on every OS |
| WebView controls | Real WebKitGTK, where WebKitGTK/WPE is installed |
| Sound | Played through the OS utility (paplay/aplay) |
| Native window handle | A real X11 XID via WindowBase.PlatformHandle (per-control handles are IntPtr.Zero everywhere — see Native interop) |
| UI Automation / screen readers | Windows-only today (Majorsilence.Forms.WindowsUIAutomation); AT-SPI is not wired up. The backend-neutral automation tree still drives tests and Selenium on Linux |
Majorsilence.Forms.WindowsFormsInterop |
Windows-only by definition — it hosts real System.Windows.Forms forms, which don’t exist here |
Deployment notes
Nothing exotic — it’s an ordinary .NET application:
dotnet publish -c Release -r linux-x64 --self-contained
Two things worth knowing:
- Native Skia binary.
SkiaSharp.NativeAssets.LinuxcarrieslibSkiaSharp.so, which links against fontconfig. Desktop distributions already have it; slim container images generally needlibfontconfig1(Debian/Ubuntu) orfontconfig(Fedora/Alpine) added explicitly. - Headless environments. For CI, servers and containers with no display, reference
Majorsilence.Forms.Headlessinstead of a desktop backend and render offscreen — no Xvfb, no display server. That’s how this project’s own test suite runs. See Automation & UI testing.
Verified on Linux
The Explorer sample — a Windows Explorer clone — runs on
Ubuntu, and the full control gallery runs on the Avalonia
backend there:

Next
- Getting started — first app, from a template or scratch.
- Migrate an existing WinForms app — the automated rewrite,
including dropping the
-windowsTFM and theSystem.Drawing.Commonreference. - WinForms on macOS — the same story on Apple hardware.
- Cross-platform WinForms — the architecture and its trade-offs.