Menu

Basic TypeScript on ASP.NET Core with Visual Studio 2015 in 5 steps

TypeScript and ASP.NET Core with Visual Studio 2015

With the new rc2 release of ASP.NET a lot happened with what we previously knew as ASP.NET 5. Not only did the naming of the framework change (ASP.NET 5 to ASP.NET Core), but also the tools we previously used for ASP.NET 5 got changed and renamed. In Visual Studio a few things changed as well, such as the templates and some tooling.

However, this post is not about to go into the details of all changes, but rather show how to get from first TypeScript file to executing it in the web browser as fast as possible.

OBS! For version disclaimer & project setup – see the bottom of the post

Aim of this post

If you want to start playing around with TypeScript and ASP.NET Core and want to get going as quickly as possible, this is the post for you. The purpose of the post is to show how to get TypeScript files transpiled to JavaScript and serve these and other static html files with ASP.NET Core.

Step 1 – Create New Project

First we need to create a new web project:
Select File -> New -> Project and then the ASP.NET Core Web Application.

Then select the Empty template.

Step 2 – Add static file serving to the pipeline

In the newly created solution, open the Startup.cs file and replace the Configure method with the following code: