I very new to TypeScript. What is the right way of using TypeScript in Visual Studio 2013 update 3? Firstly i installed TypeScript for Visual Studio 2013. But i did not get anything. When i uninstalled TypeScript for Visual Studio 2013 extension and installed web essentials for VS 2013 update 3. I actually got type script support but only when i make new project. For existing project made with VS 2013 too i can not get compile on save. I checked Tools-> options-> Text editor-> TypeScript > Project to Enable Automatic compiling, but in this section VS tells me that some error occurs during loading. Recently i figured out that VS 2013 should have typescript support out of box. Is this mean that i don`t need Web Essentials? I just want to get compiling on save for VS 2013 what should i do?
-
Are you adding typescript files? with a .ts extension? Do that and hit save on the file. 2 files should be created (.js + .js.map). With Web essentials installed go to --> Tools -> Options -> Web essentials -> Run on save (set this to true)Chris McKelt– Chris McKelt2014-10-13 13:26:07 +00:00Commented Oct 13, 2014 at 13:26
Add a comment
|
1 Answer
To convert existing web project to Typescript aware and get Typescript Build tab in project properties you will need to add a bunch of stuff into your project file via text editor.
- Add the following element at the top of Project element:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" />
- Add the following to conditionless PropertyGroup element
<TypeScriptToolsVersion>1.4</TypeScriptToolsVersion>
or 1.1 if I remember correctly previous version in case you have not 1.4 installed
- Final nugget should go to the bottom of Project lemenet
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')" />
This helped me once, but perhaps those instructions are too cumbersome and it will be easier to create new Typescript project and see what is in there related to Typescript