-1

I am using VS2015 Update 3 with Typescript 2 for VS installed. I have a simple ASP.NET Core MVC web application with a few very simple typescript files. In the root of my project I have a tsconfig.json file with "compileOnSave": true.

I have 4 versions (1.0, 1.7, 1.8 and 2.0) of Typescript installed on my PC in directory: C:\Program Files (x86)\Microsoft SDKs\TypeScript

If I save a typescript file then it is correctly compiled to a javascript file of the same name. If I then remove any generated javascript files and perform a build of the project then again the typescript files are correctly compiled to javascript files.

If I rename the directory: "C:\Program Files (x86)\Microsoft SDKs\TypeScript" to "C:\Program Files (x86)\Microsoft SDKs\TypeScript.bak" so that the typescript compilers are unavailable, then on project build I get the error: "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets(176,5): error MSB6003: The specified task executable "tsc.exe" could not be run. Could not find a part of the path 'C:\Program Files (x86)\Microsoft SDKs\TypeScript'." as expected. However, editing and then saving a typescript file still results in compile on save working and the updated javascript file being generated.

Under these circumstances, how is Visual Studio finding the typescript compiler in order to perform the compile on save?

1 Answer 1

0

Visual studio use the projects csproj file to determine what version of typescript to use. If you open the file in an editor you can look for the tag TypeScriptToolsVersion to see what version your project use.

Mine looks like this:

<TypeScriptToolsVersion>2.0.6</TypeScriptToolsVersion>

Visual studio then looks for a folder that match this version number (2.0 in my case) in the folder C:\Program Files (x86)\Microsoft SDKs\TypeScript, and whithin this folder it looks for the compiler executeble: tsc.exe.

1
  • I understand that but my point is that I have renamed the Typescript directory to Typescript.bak and the compile on save still works correctly.
    – Geoff
    Dec 7, 2016 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.