Question

I've added file1.ts and I can see there's a dependent to it - namely file1.js.

I notice that any changes I made to file1.ts - file1.js doesn't get automatically re-generated.

The only workaround I have at the moment is by calling tsc.exe - as part of pre-build event.

My question is - are there any better workaround or maybe a setting somewhere I might've missed ?

Was it helpful?

Solution

Install the Web Essentials 2012 extension in Visual Studio 2012.

It will re-generate the .js file on every save of the .ts file.

http://visualstudiogallery.msdn.microsoft.com/07d54d12-7133-4e15-becb-6f451ea3bea6

OTHER TIPS

You have to add a BeforeBuild target to your ASP.NET application's CSPROJ:

<Target Name="BeforeBuild">
<Exec Command="&quot;$(PROGRAMFILES)\Microsoft SDKs\TypeScript\0.8.0.0\tsc&quot;     @(TypeScriptCompile ->'&quot;%(fullpath)&quot;', ' ')" />
</Target>

tip: edit your csproj file with notepad.

Support for typescript has been removed from Web Essentials 2012 v3

you now need to download typescript support directly from microsoft:

http://www.microsoft.com/en-us/download/details.aspx?id=34790

In Visual Studio you need to invoke the build process for your files to be generated. The playground does not use the same build system, and it triggers the compilation once the source changes, so this is why you are seeing the difference in behavior.

plug

You can use Install-Package TypeScript.Compile to add a afterbuild target that compiles all TypeScript files included in your project.

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