Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2017 not compiling typescript

I recently updated to VS 2017 and I'm using a solution that used to work perfectly in VS 2015. I have enabled the "Compile on save" function in Tools > Text editor > TS/JS > Project and I'm sure I'm using the correct "code generation" option, but VS won't compile any typescript file.
The js output file already exist, it was generated by VS 2015, and when I save the ts file the bottom bar shows the "Output(s) generated successfully" message but there is no change in the js file.
Note that the project is under source control, but both ts and js files are checked out for edit.
I read online that similar issues were been resolved with lastes VS updates, and I'm sure my version of VS is up to date.
Does anyone know what's going on?

like image 822
Flash Avatar asked Jul 06 '17 08:07

Flash


People also ask

Does TypeScript get compiled?

Running tsc locally will compile the closest project defined by a tsconfig.json , you can compile a set of TypeScript files by passing in a glob of files you want.


2 Answers

Check ts file properties in Solution explorer. If Build action = Content, change it to TypeScript file

enter image description here

like image 175
Sel Avatar answered Oct 20 '22 03:10

Sel


in a .NET Core 2.1 project in which I has used VS's New Project template for React, I had to edit the .csproj and change <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked> to false.

Why does this option even exist!?!?!

like image 35
Ron Newcomb Avatar answered Oct 20 '22 03:10

Ron Newcomb