C# Winforms for Webassembly
Branch: master
Clone or download
roozbeh@homewin10.com
roozbeh@homewin10.com only catch my nupkg
Latest commit c003e6a Feb 7, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Samples Added Calculator sample Jan 29, 2019
Scripts correct build order and addition of appveyor.ps1 Jan 25, 2019
buildTask change name of libbz2->bz2.dll Feb 7, 2019
external add mono submodule again...neded for some header files! Jan 14, 2019
libs an initial support for keyboard Jan 29, 2019
mono-wasm another try to fix powershell lunching Jan 25, 2019
winforms an initial support for keyboard Jan 29, 2019
.gitignore new proiject to build driver and also download correct version of bin… Jan 14, 2019
.gitmodules another try to do with less submodules Jan 25, 2019
Directory.Build.props forgotten changes Jan 21, 2019
LICENSE
README.md fixed application Jan 25, 2019
WasmWinforms.sln remove sample nuget compilatiion Feb 1, 2019
appveyor.yml only catch my nupkg Feb 7, 2019
azure-pipelines.yml Set up CI with Azure Pipelines Jan 22, 2019
runvisualstudio.bat forgotten changes Jan 21, 2019

README.md

WasmWinforms

C# Winforms can now work in your browser! Wasm.Winforms is a nuget package that you can install and use your codes unchanged and run it on your browser!

Try it online

How to use

  • Create a Winforms application from Visual Studio. (Note: Winforms are full .Net applications)
  • Create an empty .Net Core App from Visual Studio. Add all files from full .net application directory into it. (For example, add Form1.cs,Form1.Designer.cs, Form1.resx, Program.cs .You can add those files as links too.)
  • Install latest version of Winforms.Wasm nuget from nuget.org.
  • Build your project.
  • You can debug Win32 (32bit version) of your code in Visual Studio. (Make sure you have 32bit version of dotnet installed! (it should be in Program Files (x86)\dotnet\dotnet.exe)
  • Looking at your OUTPUT DIRECTORY\dist\ you will find your index.html to run!

How it works

This project uses mono to run your C# IL code. Also coming with this distribution are System.Drawing and System.Windows.Forms dlls. Winforms implementation requires many C libraries that I was also ported into WebAssembly. You can find out about them looking into their submodules!

How to compile/build

This project uses another amazing ( :D ) project of mine: GCCBuild which enables you to use any compiler to compile Visual Studio C/C++ projects in any OS. Meaning you can have Visual Studio C/C++ project files and use them to compile both for Windows/Linux and also WebAssembly. You need to have Emscripten installed, activated and already accessible from your path. First from Visual Studio build for Release-x86 then build for WasmRel-x86. This way you have all libraries compiled for Win32 and also WebAssembly. Using Win32 compiled libraries are way easier to debug and run your application.

Please note that compiling mono-wasm should only be done in WasmRel or WasmDbg targets and it would take a minute or two to complete!

Why is it so slow/buggy?

You need to download good amount of files to run it. All dlls and big .wasm and .js files have to be downloaded. File issues and submit pull request so it will be faster/less buggy! There are many many bugs and this project/product is not at all recommended for production. It is pre-alpha phase!

We have many better UI frameworks for browsers and web, why use Winforms?!

Well that is a really good question that you have to answer! For me it was a fun project. But many companies are still using old programs and they would like to use them as-is in a browser, so it would open tons of new oppurtunities for those programs!

Things to do - You can pick one and contribute!

  • Update mono Winforms to latest version
  • Update mono version being used. Mono is rapidly changing/improving their WebAssembly technology....
  • Use AOT mono
  • Find bugs in libgdiplus that causes memory leaks
  • Improvements to amazing Microwindows project and make it in-sync