TypeScript assembly value "Compile on Save" does not work in VS 2015, .js file is generated only during assembly

EDIT

Why is this problem extremely painful ? While I was debugging / testing my web application, I just edited .ts in the VS IDE, saved, and then reloaded the page and tested the changes. Now I need to build. However, the assembly is not activated when a debugging session is running in the VS IDE. So now I have to do a full review: edit.ts -> save -> stop debugging -> build -> start debug. Again, this is very painful. End edit

I have not checked / saved / checked the option on the TypeScript Build tab in my project settings.

enter image description here

The corresponding <PropertyGroup> been generated and saved in my .csproj file.

(note without changing any TypeScript Build parameter, this <PropertyGroup> does not exist (when using an existing project that was previously created using VS 2013), and the default values ​​for the assembly do not match the default values ​​for the IDE UI, so that you were misled.)

In any case, after this change / save, my .csproj file is synchronized with the IDE interface, here it is:

 <PropertyGroup Condition="'$(Configuration)' == 'Debug'"> <TypeScriptRemoveComments>True</TypeScriptRemoveComments> <TypeScriptTarget>ES5</TypeScriptTarget> <TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled> <TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny> <TypeScriptModuleKind>None</TypeScriptModuleKind> <TypeScriptOutFile /> <TypeScriptOutDir /> <TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations> <TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError> <TypeScriptSourceMap>True</TypeScriptSourceMap> <TypeScriptMapRoot /> <TypeScriptSourceRoot /> </PropertyGroup> 

As shown, the Compile on Save function is definitely enabled. However, the .js file is only generated during build, and not when the .ts file is saved.

Btw: Regarding the fact that TypeScript compilation is the msbuild task in VS 2015 implementation, I wonder how this Compile on save setting even works ...

Additional diagnostics: It is interesting that if I delete the entire group of properties, then it will actually compile when saved. (The user interface remains unchanged, and .map files are not generated when saved, only during assembly.)

+6
source share
4 answers

Have you looked for the "Tools" menu <options ... <Typescript <of the project and check the "compile on save" box?

+4
source

I finally got it by adding "compileOnSave": true to my tsconfig.json .

So you tsconfig should look like this:

 { "compilerOptions": { .... }, "compileOnSave": true } 
+3
source

Worked for me when I moved compileOnSave to to compilerOptions in the tsconfig file.

+2
source

I had the same problem, so I:

  • follow citykid advise
  • the created .js.map file ,
  • I tried your guide - it started to work, however I
    • compared the PropertyGroup class, which was slightly different, so I tested your configuration and
  • re-enabled debuggers from citykid advise

... And it still works like a charm.


It may not matter, but I have:

  • Visual Studio Pro 14.0.23107.0
  • Microsoft ASP.NET and Web Tools 14.0.60814.0
  • TypeScript for MS VS 1.6.3.0 (!)
  • Installed Web Essentials 0.5.197
  • Installed web compiler 1.8.270
  • Bundler installed and Minifier not
  • ReSharper 9.2 (?)

To test this, I recommend:

  • open .js.map,
  • change .ts by adding the function -.js.map reloads,
  • debugging in IE,
  • change .ts by adding the function -.js.map reloads,
  • reload the page, and it should reflect the changes in both the debugger and the browser.
+1
source

All Articles