19

Closed

Underlying JS file not rebuilt/changed after TS file is changed.

description

Environment:
  • Windows 7 Professional Service Pack 1
  • Visual Studio 2012 Professional
Created a new ASP.NET MVC 4 Empty Project and added a .TS file to a Scripts folder that I had added. The .TS File contains the sample Shapes TypeScript example.

As I edit the .TS file, and rebuild the project. I notice that the underlying .JS still has the Shapes example code, not the code I've written. I cannot spot what I'm supposed to do in order to rebuild the .JS file so that it contains my code.
Closed Dec 28, 2012 at 8:56 PM by billti
Closing this issue for now, as it appears to have become a request around compile-on-save and better project support. This is work on our backlog we just haven't don't yet, not 'issues' (i.e. defects) in the work we have done.

comments

billti wrote Oct 1, 2012 at 10:58 PM

The templates that ship with the first release of TypeScript only ship with a ASP.NET MVC 3 template, not MVC 4. If you select MVC 3, then next dialog will offer a "TypeScript Internet Application" template, which should behave as you expect.

If you look at the structure of the project file for this MVC 3 project, you should be able to mimic what it is doing in your MVC 4 project relatively easily.

KenStone wrote Oct 1, 2012 at 11:40 PM

To be explicit, put this in your MVC4 project file:

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

I put it right before the <Target Name="MvcBuildViews..........

Works for existing MVC4 projects too.

shanselman wrote Oct 2, 2012 at 11:31 AM

I'd recommend you talk to Mads Kristiansen about how he integrated LESS, SASS and CoffeeScript support into the WebEssentials. Having to add a BeforeBuild batch file is kind of sub-optimal. Check out his CoffeeScript splitscreen. It autoupdates on save, not on build.

MrClyfar wrote Oct 3, 2012 at 9:17 AM

Looks like Mads has done it again :)
http://visualstudiogallery.msdn.microsoft.com/07d54d12-7133-4e15-becb-6f451ea3bea6

Update Web Essentials for VS2012 now has support for TypeScript rebuilding when you save your .ts file (no need to build the project).

thorn0 wrote Oct 9, 2012 at 12:41 PM

If rebuilding get implemented with an ASP.NET build provider, it would work even without Visual Studio, with any editor.

About build providers: http://weblogs.asp.net/scottgu/archive/2005/09/02/424337.aspx
A separate issue for this idea: http://typescript.codeplex.com/workitem/122