typescript and angularJS in asp.net 5 (vnext) Project in Visual Studio 2015

Thought asp.net 5 is full of js and node goodness, there is no view of TS anywhere

The TypeScript support coming for ASP.NET vNext is through the Grunt or Gulp task runners. Since vNext doesn’t have dependencies on Visual Studio for any compilation and is cross platform, Grunt or Gulp is the preferred way to compile it. There are already tasks out there for doing so with those task runners.

 

http://marcinjuraszek.com/2014/11/compile-typescript-in-asp-net-5-application-using-grunt-typescript.html

 

Now I plan to create a Typangular Project with MVC 6 WebAPI backend

Starting here: http://www.asp.net/vnext/overview/aspnet-vnext/create-a-web-api-with-mvc-6

Now that that’s done, to create typescript angular app, I want to use yeoman..

Googled for typescript angular project scaffold using node.js

Ok, so as I see it, there are 2 ways:

  1. First create a Typescript Project, then add Typings from NuGet and finally use Sidewaffle templates for creating controllers etc.
    1. I’ve done this before and it works well
  2. Another is to first create a asp.net 5 project, and design the webAPI (like I’ve done above http://www.asp.net/vnext/overview/aspnet-vnext/create-a-web-api-with-mvc-6) and then use the grunt, bower and npm to write angular code in TS. Note that this link shows creation of webAPI in Empty project. With empty project as starting point the grunt and bower and npm goodness is absent. So better start with “ASP.Net Starter template” as it’s easier to delete MVC M

For this I looked into yeoman generator for TS etc. but it wasn’t there.

Thankfully grunt-contrib-typescript is there for me to create js out of TS on building ASP.Net Project (http://marcinjuraszek.com/2014/11/compile-typescript-in-asp-net-5-application-using-grunt-typescript.html)

Also, the Typings from NuGet can be obtained here, though I’ll prefer to get it from TSD node module.

But Sidewaffle templates for creating controllers etc are not available. In fact you can’t even create a new TS file in asp.net vNext project

Tried the new “Shared Project” template in VS 2015, but that also doesn’t allow TS Files with asp proj

But as it’s something that I can live with, I’m going with option 2 for now

 

Advertisements

One thought on “typescript and angularJS in asp.net 5 (vnext) Project in Visual Studio 2015”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s