Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling existing C# code to WebAssembly

Is it possible to compile existing C# code to WebAssembly (.wasm) so that no or nearly no code changes have to be done?
Do I have to use Blazor for it or are their other possibilities?

like image 288
Janine Avatar asked Jan 26 '21 12:01

Janine


People also ask

What does compiling C code mean?

Compiling a C Program. Compiling is the transformation from Source Code (human readable) into machine code (computer executable).

Does C code need to be compiled?

C is a mid-level language and it needs a compiler to convert it into an executable code so that the program can be run on our machine.


1 Answers

Is it possible to compile existing C# code to WebAssembly (.wasm)

No, there is no compiler (yet). But

so that no or nearly no code changes have to be done?

That is easy, you can simply add .net DLLs (packages) to your project.
Just make sure that the code makes sense in a Browser, ie no Threading, no I/O except HttpClient etc.

Do I have to use Blazor for it or are their other possibilities?

For now there is only Blazor.

like image 169
Henk Holterman Avatar answered Oct 21 '22 20:10

Henk Holterman