Showing posts with label TypeScript. Show all posts
Showing posts with label TypeScript. Show all posts

TypeScript Template for ASP.NET MVC4

Microsoft introduced TypeScript to the world on October 1, 2012. Read my post on Hello TypeScript – Getting Started if you are new to TypeScript. It’s a typed superset of JavaScript and has rich tooling support. However it’s still in Alpha and there is only one ASP.NET MVC project that has TypeScript integrated in it and that is for ASP.NET MVC3. To use it in ASP.NET MVC4, you need to jump through a few (not so difficult) hoops.

So while until VS2012 out-of-band change comes in and adds the support for us, let us see what we can do to help ourselves. In this article, we will see the steps required to Add TypeScript support to MVC4. In the end, we will end up with a reusable Visual Studio Project template.

Pre Requisites

Make sure you have TypeScript plugin for Visual Studio 2012 installed. You can get it from www.typescriptlang.org/#Download.

Reverse Engineering the MVC3 Template

Fire up Visual Studio and start the new MVC3 Project Template.

Hello TypeScript – Getting Started

A first look at TypeScript and what it takes to get started with the newest language on the block from Microsoft using Visual Studio 2012.

What is TypeScript?

October 1, 2012 will probably be remembered in the history of Software Development when Microsoft Technical Fellow and father of C# Anders Hejlsberg announce TypeScript, a new Type conformant JavaScript. A language that compiles down to plain JavaScript but on its own has all the hallmarks of a language with first class tooling support in Visual Studio. If you have an hour to spare, go through Anders introduction, you’ll love it. If not, go through this article and you’ll get the gist. Bottomline, don’t start ranting too soon. TypeScript has a lot to offer.

Getting Started

Microsoft has made it really easy to get started with TypeScript. You have an online web-based code editor cum compiler. They also have a Visual Studio 2012 plugin that works on the Professional and above editions. Since a lot has been made about the benefits of ‘tooling’ while introducing TypeScript, we will download and install the TypeScript plugin.

Note: TypeScript is available in Sublime Text, Vi, Emacs editor

Once the Plugin is installed, start Visual Studio, find the Html Application with TypeScript. Strangely enough it goes under the Visual C# category hence it took a minute to find.