Thursday, January 16, 2014

Making TypeScript compile on TFS2010 Server


So the thing is TypeScript is not included with VS2013 out of the box.  I thought it was included but it not I had to download “TypeScript for VS2012 and VS2013” and install locally. When you try to build your web project locally with VS2012/13 then it will produce .js file.  So that’s well and good.  But when you try to build on build server it will not work. As expected because it doesn’t have the Targets to compile .ts file. 


1.  Like most build environments if you have VS2012/13 already installed on your build server then download the “TypeScript for Visual Studio 2012 and 2013” and install on the build server.  This will build the .ts file into .js file on the build server.  However, keep in mind that when you build your solution locally this file (.js) is also created locally and this file should not be included in your source control folder just like normal practice we don’t include .dll files from the bin folder or .exe files from obj folder.  Exclude that file or convert that file into .ts file and delete the duplicate file.

2. Another way to compile TypeScript files on the Build Server is detailed by Tom DuPont – And that is to create separate folder on Source Control and reference the targets from there.

I am sure there are other ways but I found method 1 to be easiest as I already have VS2012 and VS2013 installed on the build server.