TypeScript 0.9.1.1 Not always compiled on save

using VS 2012 Update 3, TSC 0.9.1.1 and the latest version of Web Essentials (although this was a problem since Web Essentials removed support for TypeScript).

Very often TypeScript will not compile when saved. I had to resort to opening the .js file at the same time, and I hope that I get a message about a file change. But then it will stop building, and therefore the file will not be modified, and I will not see the message.

Sometimes there is a problem with the error errors that TypeScript generates, which I know because it usually removes ";" and adding it back will usually make it rethink the error and remove it. The error does not even have to be in this file, and fixing the error never fixes the save and compile function.

The only fix I found was to close the .ts file, and the .js file (.js) is important). Then open .ts, wait until it is fully downloaded and then download the .js file in that order or it will never work (you do not need to open the .js file, but if you open it first it will not work).

I tried to restart (VS and Win 7) and this will fix it for a while, but in the end it often stops working again and again.

This is very annoying as I write TypeScript the vast majority of the day.

+6
source share
7 answers

I wrote grunt-ts to run our typescript compilation, which works reliably every time: https://npmjs.org/package/grunt-ts

Watch the video tutorial: http://youtu.be/Km0DpfX5ZxM

+1
source

I find that compiling the project (cs / vb) is required to create the source .js file. After that, compiling typescript with saving works correctly.

+1
source

You need to update the csproj file of the visual studio project manually. I had to include the following lines in order to compile the save functions again.

<PropertyGroup Condition="'$(Configuration)' == 'Debug'"> <TypeScriptTarget>ES5</TypeScriptTarget> <TypeScriptIncludeComments>true</TypeScriptIncludeComments> <TypeScriptSourceMap>true</TypeScriptSourceMap> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)' == 'Release'"> <TypeScriptTarget>ES5</TypeScriptTarget> <TypeScriptIncludeComments>false</TypeScriptIncludeComments> <TypeScriptSourceMap>false</TypeScriptSourceMap> </PropertyGroup> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" /> 

Additinaly, I had to save most of my .ts-Files and set the file encoding to code page 65001.

0
source

Try the following instructions to ensure that each of your TypeScript files has an assembly action set to TypeScriptCompile .

Compile-on-save

Also see my answer HERE to take on some of the suspicious confusion with TypeScript support.

0
source

I found that it is enough to close any application (in my case notepad ++) that accessed the javascript file, and then open the javascript files again. I did not need to close Visual Studio or close and open any of the Typescript files inside Visual Studio.

I am running VS Express 2013 for web update 2 RC.

0
source

I decided to right-click it on the typescript file and set BuildAction to None. enter image description here

0
source

I had the same problem, typescript compilation simply wouldn't work at all after two hours of debugging the program. Rebooting the system did not help, rebooting Visual Studio did not help. What ultimately worked for me was the removal of a tool called Web Essentials

0
source

Source: https://habr.com/ru/post/955947/


All Articles