Search code examples
c#javascriptcompiler-construction

Javascript and C# Cross Compiling and Conversion


What are the various tools to cross-compile or convert Javascript to C# and back? And how to execute JS in C# or C# in JS? This is a popular question, and I will provide answers for it.


Solution

  • Compile C# to Javascript

    • SharpKit (site) - Write and debug C# 4.0, compile to JS
    • Blade - Write C# and compile to JS, Interfaces for DOM, HTML, CSS
    • ScriptSharp - Write C# and compile to JS, jQuery supported
    • Saltarelle - Write C# 5.0 and compile to JS, LINQ, jQuery, NodeJS supported
    • JSIL - Compile CIL bytecode to human-readable JS
    • JSC - Compile CIL bytecode to JS, ActionScript, Java, PHP

    Run Javascript in C#

    • IronJS - Javascript on CLR/DLR Runtime, Ecmascript 3.0
    • Jint - Javascript VM, Ecmascript 3.0
    • Jurassic - Compiles JS into .NET CIL, ECMAScript 3 and ECMAScript 5
    • MS JScript Engine - Legacy scripting Javascript engine

    Run C# In Javascript

    • Edge.js - Run C# code alongside Node.js, in-process