Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeScript in Visual Studio 2012 not compiling

Tags:

I have installed TypeScript (v0.9.1.1) on my Visual Studio 2012 installation but I cannot make it compile my .ts files during build (see screenshots below).

I have already tried a lot of different solutions posted here but none of them worked for me.

Please note that I can create a TypeScript project, the problem is that Visual Studio is not compiling/creating the .js file.

enter image description here

enter image description here

like image 301
StockBreak Avatar asked Sep 13 '13 12:09

StockBreak


People also ask

Can TypeScript be compiled?

TypeScript is compiled, rather than interpreted like JavaScript, which means errors can be caught before execution; IDEs that perform background incremental compilation can spot such errors during the coding process.

How TypeScript gets compiled?

The TypeScript compiler compiles these files and outputs the JavaScript with . js extension by keeping the same file name as the individual input file. The TypeScript compiler also preserves the original file path, hence the . js output file will be generated where the input file was in the directory structure.

Which command is used to compile TypeScript?

As you know, TypeScript files can be compiled using the tsc <file name>. ts command.


1 Answers

Try to introduce error in your typescript file and make a build of the project. Does it show up error pane?

Also the js files are not part of the solution. Do you look for them on disk ?

Also check that your project file has following entries in it. Along the lines more less:

<ItemGroup>     <TypeScriptCompile Include="app.ts" />   </ItemGroup>  <PropertyGroup Condition="'$(Configuration)' == 'Debug'">     <TypeScriptTarget>ES3</TypeScriptTarget>     <TypeScriptRemoveComments>false</TypeScriptRemoveComments>     <TypeScriptSourceMap>true</TypeScriptSourceMap>     <TypeScriptModuleKind>AMD</TypeScriptModuleKind>   </PropertyGroup>   <PropertyGroup Condition="'$(Configuration)' == 'Release'">     <TypeScriptTarget>ES3</TypeScriptTarget>     <TypeScriptRemoveComments>true</TypeScriptRemoveComments>     <TypeScriptSourceMap>false</TypeScriptSourceMap>     <TypeScriptModuleKind>AMD</TypeScriptModuleKind>   </PropertyGroup>   <Import Project="$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets" /> 
like image 59
stride Avatar answered Oct 21 '22 12:10

stride