Question

I just updated my Web Essentials to 3.6.5 and my *.ts files are not being compiled to javavscript.

Also, when I go into Web Essentials-Typescript-Options the only option displayed is Show Preview Window and the right pane says CoffeeScript not Typescript.

Where are the other options?

Was it helpful?

Solution

I updated my csproj file according to these instructions

2015.01.30 The link still works for me, but here is the content.

With TypeScript 0.8.2, we've enabled the ability to compile a project when source files in the project are saved, circumventing the usual manual compile step.

For this to work, you need to enable the global setting in Tools->Options->Text Editor->TypeScript->Project. Specifically, enable "Automatically compile TypeScript files which are part of a project".

Next, you need to make sure your Visual Studio project uses the new TypeScript targets file. You can do this in one of two ways. New projects created with the TypeScript 0.8.2 release will automatically include a link to this targets file (as will the new version of the Windows 8 sample in the samples directory). For projects made with previous versions, you will need to edit the project file by right-clicking the project, selecting "Unload Project", right-clicking the project, selecting "Edit", and updating the project XML with the following:

For each TypeScript file in your project, change the build action to 'TypeScriptCompile':

<TypeScriptCompile Include="app.ts" />

Then additionally add (or replace if you had an older PreBuild action for TypeScript) the following at the end of your project file to include TypeScript compilation in your project.

For C#-style projects (.csproj):

  <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" />

OTHER TIPS

Typescript support was removed from web essentials a while ago, and only recently were some options added back in. If you had a lot more options before, you probably upgraded from before 3.0, when they had more typescript support.

You may want to consider checking that you have the latest version of typescript installed (0.9.5) http://www.microsoft.com/en-us/download/details.aspx?id=34790

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top