How to get MsBuild Packaging to compile TypeScript
My current project (.Net MVC5 + TypeScript 1.0) will be packaged by our Continuous Integartion server to a MsDeploy package which we can easily deploy to our dev/test/production environments. But we found out that after deploy no JS files were existing due to the TypeScript compiler not running. At the TypeScript website exists a lengthy thread about this issue found here.
The solution I have chosen is to install Typescript on my build servers. But this did not seem to solve the problem because the TS files are still not compiled. This happens due to the following code in mine (or your) .csproj file:
This tries to find the typescript tasks for MsBuild but only if the file with the task definition exists on disk.
Steps to fix typescript on your build server:
Copy the TypeScript folder from your local dev machine to your build server => C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\TypeScript
NOTE: This is for Visual Studio 2013 (=v12.0). For Visual Studio 2012 copy it to \v11.0\TypeScript. After this step your build server will find the TypeScriptCompile task and try to compile it. But it will complain that the TypeScript compiler executable is missing. To fix that:
Copy the correct TypeScript compiler version folder to the correct location => C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0
NOTE: I have installed TypeScript 1.0 (Visual Studio 2013 RC2) which links the MsBuild task to ...\TypeScript\1.0\tsc.exe. If your build server complains that it wants a different version, just move the correct version to the specified folder.
After you have copied these two folders the compiling of TypeScript files will be re-enabled on your build servers