DuoCode | take your C# code and skills to the web

C#-to-JavaScript compiler
with TypeScript support
powered by Microsoft® Roslyn


Download DuoCode

Free 30-day trial

Try DuoCode

Live in your browser

Supports

Features

The power of
Visual Studio

Enjoy the convenience of Visual Studio - the best IDE in the world, with state-of-the-art development and debugging experience.
More information

The power of
the C# language

Enjoy the power and convenience of C# 6.0 language, complete with strong-typing, class-based inheritance, reflection, generics, lambda expressions and LINQ.
See complete list

The power of
.NET Framework

Utilize the familiar classes in the standard libraries of the .NET Framework, including string manipulations, collections, and more.

The power of
DuoCode

Cross-compile C# code into readable and maintainable JavaScript.
Share code between Windows and JavaScript applications.
See code samples

Also featured in...

Compile C# code to JavaScript in Visual Studio


DuoCode is a fully-featured C# compiler, powered by Microsoft® Roslyn, and integrated in Visual Studio.

It cross-compiles your C# 6.0 code into high-quality readable JavaScript code, enabling rapid development of web applications utilizing the extensive features of the C# language, the Visual Studio IDE, and the .NET Framework base class libraries.

Development in C# with Visual Studio brings great productivity wins, thanks to strong-typing, code completion, compile-time error checking, static analysis, code navigation and refactoring, as well as the new Roslyn-powered diagnostic live-code analyzers.

Develop HTML5 applications using strongly-typed and documented class-definitions of the entire DOM class library (including HTML, CSS, SVG and WebGL definitions).

See code samples

Features supported in DuoCode

C# language features

C# Classes
Method overloading
Properties
Interfaces
Generics
Integral types
Events and delegates
Lambda expressions
Arrays
Structs
ForEach, Enumerators, Yield
Enums
Loops
Reflection
Dynamic binding
Nullable types
Ref and Out
Params
Optional arguments
Extension methods
Attributes
Operator overloading
Casting
Async and Await
Exceptions
Collections
LINQ
Integer arithmetic
Conditional operator (?:)
Null-coalescing operator (??)
Checked operations


C# 6.0

nameof
Expression-methods
Expression-properties
Auto-property initializers
Exception filters
using static
String interpolation
Null-conditional operators
Index initializers


More features

TypeScript
Hybrid C# / TypeScript projects
Strongly-typed DOM/HTML5
Strongly-typed WebGL
Resource embedding
Mono / XBuild support
Continuous Integration (CI) ready
Typed arrays
JSDoc generation
AMD, CommonJS and UMD
Closure-friendly output
Roslyn diagnostic analyzers
Web Workers
Compiler services


Visual Studio integration

Project templates
Debugging (VS2013/2015)
Project property page
NuGet support
MSBuild support
Resource editor
Shared projects support
Web publishing (Azure)

Amazing C# debugging


DuoCode automatically generates source mappings, which allow you to view and debug the original C# source files directly inside the browser or in Visual Studio 2013/2015.

This groundbreaking feature enables full C# debugging using the browser's built-in developing tools, including source stepping, breakpoints, watches and complete C# call-stack.

Experience it yourself - try it live in your browser!

image1

DuoCode

 Magic

C#

using System;
using DuoCode.Dom;
using static DuoCode.Dom.Global; // C# 6.0 'using static' syntax

namespace HelloDuoCode
{
  public class Greeter
  {
    private readonly HTMLElement element;
    private readonly HTMLElement span;
    private int timerToken;

    public Greeter(HTMLElement el)
    {
      element = el;
      span = document.createElement("span");
      element.appendChild(span);
      Tick();
    }

    public void Start()
    {
      timerToken = window.setInterval((Action)Tick, 500);
    }

    public void Stop()
    {
      window.clearTimeout(timerToken);
    }

    private void Tick()
    {
      span.innerHTML = string.Format("The time is: {0}", DateTime.Now);
    }
  }

  static class Program
  {
    static void Run()
    {
      System.Console.WriteLine("Hello DuoCode");

      var el = document.getElementById("content");
      var greeter = new Greeter(el);
      greeter.Start();
    }
  }
}

JavaScript

var HelloDuoCode = this.HelloDuoCode || {};
var $d = DuoCode.Runtime;
HelloDuoCode.Greeter = $d.declare("HelloDuoCode.Greeter", System.Object, 0, $asm, function($t, $p) {
    $t.$ator = function() {
        this.element = null;
        this.span = null;
        this.timerToken = 0;
    };
    $t.ctor = function Greeter(el) {
        $t.$baseType.ctor.call(this);
        this.element = el;
        this.span = document.createElement("span");
        this.element.appendChild(this.span);
        this.Tick();
    };
    $t.ctor.prototype = $p;
    $p.Start = function Greeter_Start() {
        this.timerToken = window.setInterval($d.delegate(this.Tick, this), 500);
    };
    $p.Stop = function Greeter_Stop() {
        window.clearTimeout(this.timerToken);
    };
    $p.Tick = function Greeter_Tick() {
        this.span.innerHTML = String.Format("The time is: {0}", $d.array(System.Object, [System.DateTime().get_Now()]));
    };
});
HelloDuoCode.Program = $d.declare("HelloDuoCode.Program", System.Object, 0, $asm, function($t, $p) {
    $t.Run = function Program_Run() {
        System.Console.WriteLine$10("Hello DuoCode");

        var el = document.getElementById("content");
        var greeter = new HelloDuoCode.Greeter.ctor(el);
        greeter.Start();
    };
});
Choose sample:

Contact Us

We’d love to hear from you