Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ensure exactly which TypeScript compiler Visual Studio is using during build?

Context

Recently TypeScript compiler (1.8.x) became available as Nuget Package too. However here is a bit cloudy fact that there are two packages

  • a) Microsoft.TypeScript.Compiler (no dependencies)
  • b) Microsoft.TypeScript.MSBuild (**no dependencies but contains TypeScript.Compiler...btw:why?)

In my project (.csproj) TypeScript version was set to 1.7 originally

<TypeScriptToolsVersion>1.7</TypeScriptToolsVersion>

I wanted to know what happens after installing a) or b)

Issue/Question

I do not know simple way how to diagnose what is exactly happening during the Visual Studio 2015 build about TypeScript compile.

  • I do not know how to see any output from tsc.exe (like version number, path, etc)
  • I do not know how to see any resulting (effective) setting from which path the MSBuild task will launch tsc.exe

Diganostic results (optional reading, if anyone is interested)

Because of my lack of knowledge I had to use Mark Russinovich's ProcessMonitor to make sure what is happening. This is the question: How to do this more simple?

  • Installing a) does nothing except coping a working instance of tsc to your project's /packages folder. The .csproj file was not touched. Consequently the originally configured MSBuild task will apply to .ts files and original installed tsc 1.7 is running from Program Files

  • Uninstalling a) Correctly "restores" the original state. (Well, this is nothing else than deleting the package from the /packages folder

  • Installing b) The same as a) + changes the MSBuild task entry in .csproj. As a result the new tsc 1.8 will run from the /package folder.

  • Uninstalling b) Removes all, including all TypeScript related MSBuild task from the .csproj file. This is silently disables all ts file compilation (with no warnings and errors). The simple way to restore the default behaviour is to add a dummy .ts file to your project, which will insert the default MSBuild task back to your .csproj file.

Either install was touched the setting:

<TypeScriptToolsVersion>1.7</TypeScriptToolsVersion> 

Back to the question

Is there a simpler way to see what is exactly happening about TypeScript during VS 2015 build, than using ProcessMonitor?

like image 887
g.pickardou Avatar asked Mar 31 '16 07:03

g.pickardou


1 Answers

This is probably a little late but if you run msbuild with msbuild /verbosity:Detailed or msbuild /v:Detailed it will give you much more detailed information as to what is going on with the typescript compilers.

Just search for tsc.exe in the build output and you will see the version of typescript it is using

like image 108
Alexis Coles Avatar answered Sep 22 '22 03:09

Alexis Coles