Tuesday, January 1, 2013

Using TypeScript with an existing ASP.NET project.

TypeScript looks very powerful for me, and I want to use it with all my ASP.NET projects. But I found it is not trivial to add support of TypeScript to an existing project. After installing TypeScript for Visual Studio 2012 I was able to add new TypeScript file (*.ts) to the project, but any changes in the *.ts file did not affect it's output *.js file. Seemed like TypeScript compiler doesn't work for me. It was strange, because I found it works perfect in test project created from TypeScriptHTMLApp template.

After comparing *.cspoj files I found the difference - there is an "magic" build step has done to compile *.ts files in TypeScriptHTMLApp template:




I just added this lines in my existing project's *.csproj file and it works fine now.

Later I found the same answer in Stack Overflow. (Should I've searched there for an answer first? :))


1 comment:

  1. I found another solution:
    http://stackoverflow.com/questions/13850578/converting-a-typescript-build-event-into-an-external-tools-command

    ReplyDelete