When I build the project, it is redundantly building script event though I have script compiling on run/debug. Is there a way to make it only build on save?
-
You must have an enormous amount of TypeScript for this to be a problem.Robert Harvey– Robert Harvey2013-01-29 15:45:57 +00:00Commented Jan 29, 2013 at 15:45
-
Not really, but I have the compiled .js open in an editor window as well as the .ts file and I get prompted twice as to whether I want the .js window to reload the updated file.Richard Collette– Richard Collette2013-01-29 15:48:54 +00:00Commented Jan 29, 2013 at 15:48
-
Are you using Web Essentials, or just the TypeScript extension?Fenton– Fenton2013-01-29 15:53:52 +00:00Commented Jan 29, 2013 at 15:53
-
I am not using Web Essentials 2012 because I am using VS 2010 on Vista. stackoverflow.com/questions/14510511/…Richard Collette– Richard Collette2013-01-29 16:32:35 +00:00Commented Jan 29, 2013 at 16:32
Add a comment
|
2 Answers
If you have installed Web Essentials 2012 extension it is very easy.
In Visual Studio go to Tools -> Options -> Select Web Essentials, Under the TypeScript set "Compile TypeScript on Save" to True

3 Comments
Richard Collette
Sorry, I am not using Web Essentials 2012 because I am doing this in VS 2010 on Vista. I see where it allows you to disable "Compile all TypeScript files on build."
Rajeesh
@RichardCollette I think Web Essentials 2010 doesn't have TypeScript support. What you could do is, edit your project file and remove the "BeforeBuild" target. In the project file there will an entry something like this "<Target Name="BeforeBuild"> <Exec Command=""$(PROGRAMFILES)\Microsoft SDKs\TypeScript\0.8.0.0\tsc" @(TypeScriptCompile ->'"%(fullpath)"', ' ')" /> </Target>".
Richard Collette
As of version 0.8.3.1 there is no BeforeBuild target entry for the TypeScript compiler.
You can set the build type to none and saving the .ts file will still build the .js file. However, the .js file does not get checked in to TFS so when someone gets the project, they would have to open and save every file. This seems to be another issue.
2 Comments
Rajeesh
Have you included the js file in your project?
Richard Collette
The .js file is included in the project by default (at least when the .ts file is created using the item template). There is no option in the context menu of the .js file to include it in source control.