Compiling legacy TypeScript

Last week I installed Visual Studio 2015. This week I was unable to use Visual Studio 2013 to rebuild a legacy app that included TypeScript 1.0 code originally developed in Visual Studio 2012. Here’s how I sorted it out.

VS2015 installed TypeScript 1.7. I won’t be using TypeScript going forward so I uninstalled the TypeScript 1.7 compiler in Programs & Features.

This is not enough though. Now I received an “unknown option: ‘noEmitOnError'” during building. TypeScript compilers (as of present) share a common MSBuild target file which contains the 1.7 options even after you uninstall. The file is at C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\TypeScript\Microsoft.TypeScript.jsproj.targets (Adjust the v12.0 as approriate for your version of VS). I ended up overwriting the entire TypeScript folder (keep a backup!) with a copy from another developer who had not yet upgraded. However I did discover that you can copy the targets file from an older version folder as well. (The one from v11.0 worked for me too, but it is slightly different.)

If you need to compile multiple versions of TypeScript, I think you’ll have to make a copy of the TypeScript folder and edit your csproj file to point to the correct one. The relevant line is: