Compile C# to JavaScript with DuoCode

Compile C# to JavaScript with DuoCode

Using Microsoft Roslyn and Visual Studio, dev shops with C# assets can compile apps to run in the browser with no extra coding

A new compiler lets programmers use their C# skills to build JavaScript and HTML5 Web applications. By integrating with Microsoft's Visual Studio IDE and leveraging Microsoft's Roslyn compiler technology, the DuoCode compiler enables cross-compiling of C# code into JavaScript, for sharing of code between JavaScript and Windows applications.

"DuoCode understands' C# using the Roslyn compiler," said Stav Harel, of DuoCode, in an email. "Roslyn performs the code-parsing, syntactic tree (AST) generation, and contextual analysis. Then DuoCode takes over to perform the code translation and generates JavaScript code -- along with source maps -- while completing language features that exist in C# and are missing in JavaScript." Roslyn features open source C# and Visual Basic compilers offering code analysis APIs.

DuoCode is another tool for compiling to JavaScript without actually writing JavaScript. Google's Dart language also offers this capability, as does Microsoft's own TypeScript. Harel sees DuoCode, which is a commercial technology and not open source, as a solution for organizations with vast C# assets, including projects, code, and knowledge, to reuse these assets in JavaScript. In addition, DuoCode can be used for server-side development with Node.js, mobile applications via Cordova, and games development using WebGL.

Harel says DuoCode offers an improved approach to linking C# to JavaScript.

"Even though there have been other attempts to develop C#-to-JavaScript compilers, they are very different in their approach -- not using Roslyn, not supplying source maps," Harel said. "This makes it hard for them to keep up-to-date with latest technologies like C# 6.0 and Visual Studio 2015."

Currently in public beta, DuoCode can be downloaded by registering on the company website and used until June 30. A pricing model is expected at some point, Harel said.

Follow Us

Join the ARN newsletter!

Error: Please check your email address.

Tags application developmentGoogleMicrosoftsoftware is a channel management ecosystem that automates all major aspects of the entire sales, marketing and service process, including data tracking, integrated learning, knowledge management and product lifecycle management.

Show Comments