Top VS2015 Extensions: DuoCode

[This is the second in a series of blog articles highlighting some of my favorite extensions for Visual Studio 2015. If you're interested in reading more, check out C# Essentials.]

One of my favorite Visual Studio extensions to demo is DuoCode. DuoCode is a transpiler for C# code, compiling it into JavaScript or TypeScript source code that can run client-side in the browser or as part of a node.js server application. DuoCode provides the necessary interop layer to connect your C# code into the browser DOM and conversely enables the core .NET libraries to execute within a browser context.

Within Visual Studio, the DuoCode team created a set of C# project templates that are wired up for the transpiler and class library dependencies. Some of them make for pretty good showcases in their own regard, for instance the RayTracer sample. In the screenshot below, you can see a sample of that project: fairly standard boilerplate ray tracing code.

DuoCode RayTracer demo source

When you build the project, DuoCode takes advantage of the .NET Compiler Platform (which everyone outside of the developer marketing team knows as Roslyn) to parse and translate the code into the corresponding script:

DuoCode ray trace demo executing

Additionally, it produces source map files so that a debugger can sync what is being executed in the browser with the originating C# source code. You can work with C# from your browser developer tools: setting breakpoints, add watches and so on, while still getting a high-fidelity experience:

Debugging C# code from Edge

The DuoCode team also propped up a live instance of their transpiler so you can see it in action without downloading:

DuoCode live transpiler I love the level of polish and care the DuoCode team have put into their product, and it does a great job both of showing off both their technical prowess and demonstrating how Visual Studio and the .NET platform enable others to extend our developer tooling.

Check it out: their community edition is free for academic or open source use.