Code Monkey home page Code Monkey logo

wasmwinforms's Introduction

WasmWinforms

Build status Nuget

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 switch to Release-x86 then build solution, then do the same for WasmRel-x86. This way you have all libraries compiled for Win32 and also WebAssembly. Then in your \Output\bin\x86\Release folder you can issue a nuget pack and use that nuget.

When you build an application using this nuget, look for dist folder which contains your index.html. Using Win32 compiled libraries are way easier to debug and run your application.

Please note that compiling mono-wasm project 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

wasmwinforms's People

Contributors

0xflotus avatar roozbehid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wasmwinforms's Issues

Update README

README says the following: "Maybe call it some useless technology..."

This is definitely not true. Lots of businesses run on old winforms code, which, if converted to web app could be a real benefit.

I know enterprise companies trying to do such transformations.

Unhandled Mono AssemblyResolutionException

Hi there,

I am attempting to build my application and getting the following error with the complete app not being outputted into the dist folder:

Unhandled Exception: Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'System.Windows.Forms, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
   at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
   at Driver.Import(String ra, AssemblyKind kind)
   at Driver.Run(String[] args)
   at Driver.Main(String[] args)
	WasmForm	C:\Users\myuser\.nuget\packages\winforms.wasm\1.0.19137.60\build\netstandard2.0\Winforms.Wasm.targets	13	

This is using version 1.0.19137.60 and .NET Core 2.1. If there is any additional information I can provide please let me know.

System.Drawing.New

Severity Code Description Project File Line Suppression State
Error
Unhandled Exception: Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'System.Drawing.New, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
at Driver.Import(String ra, AssemblyKind kind)
at Driver.Run(String[] args)
at Driver.Main(String[] args)
ConsoleApp2 C:\Users\hp.nuget\packages\winforms.wasm\1.0.0.33\build\netstandard2.0\Winforms.Wasm.targets 13

System.Drawing.Color giving errors

image

  at :8080/DiscordUploader.CloudForm..ctor () <0x3437bb8 + 0x00044> in <f57a8ae81ee64592a2f8ca3f7c7c3964>:0 
  at :8080/DiscordUploader.Program.Main () <0x2eab640 + 0x0000a> in <f57a8ae81ee64592a2f8ca3f7c7c3964>:0 
    at Object.call_method (mono.js:1)
    at Object.call_static_method (mono.js:1)
    at Object.init ((index):22)
    at runtime.js:11
    at mono.js:1```

I tried #4 and it didn't fix it.




[Troll] : Cannot Divide by zero

Ok this is not a real issue but it seems that unhandled exception seems to freeze the app.
I'm sorry for the troll.

That beeing said ... that's amazing !
Thx a lot for that initiative ;)

About runnning OCX

Hello, I will be doing some tests but want to know if you already tried using a OCX with it?
Example: How about use a Flash OCX to emulate flash support as an ActiveX component? I do have some client systems that will not be updated until next year, so Flash EOL is making this solution interesting.

Calculator demo does not work on Firefox

Using Firefox on Windows 10, the calculator demo does not work and logs this error to the console:-

RangeError: bad Memory initial size mono.js:1181:26
<anonymous> https://webassembly.z19.web.core.windows.net/Calculator/mono.js:1181:26

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.