Skip to content

Running Windows Forms in browser with WinFormsCompat

Nihal Talur edited this page Sep 18, 2016 · 4 revisions

CAUTION: This article is OUTDATED. It will be rewritten when time permits.

You can actually run Windows Forms apps in the browser with WinFormsCompat, included in SharpJS. It translates Windows Forms (and designer generated code) to pure HTML/JS!

NOTICE: This screenshot is OUTDATED! The current version of WinFormsCompat has a much nicer UI based on Bootstrap. Here's a screenshot of a prototype: Screenshot

In the screenshot, you can see a very simple application running in the browser, and a Web Inspector is open next to it.

You, too can run your WinForms in the browser. Here are some simple steps:

  • Create a Windows Forms application and add some basic controls like a Label or TextBox
  • Create an empty SharpJS application from the template. If you don't have the Visual Studio extensions available form the website, there's also a template in the VSAddin folder of the repository
  • Delete the MainForm.cs and WebFormsApplication.cs files in the SharpJS project.
  • Copy/Link (I recommend linking) all of the source files (.cs) from your WinForms project to the SharpJS application.
  • Build your project and hope that it works! Support is constantly being improved!