0

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?

4
  • You must have an enormous amount of TypeScript for this to be a problem. Commented 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. Commented Jan 29, 2013 at 15:48
  • Are you using Web Essentials, or just the TypeScript extension? Commented 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/… Commented Jan 29, 2013 at 16:32

2 Answers 2

1

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

enter image description here

Sign up to request clarification or add additional context in comments.

3 Comments

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."
@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="&quot;$(PROGRAMFILES)\Microsoft SDKs\TypeScript\0.8.0.0\tsc&quot; @(TypeScriptCompile ->'&quot;%(fullpath)&quot;', ' ')" /> </Target>".
As of version 0.8.3.1 there is no BeforeBuild target entry for the TypeScript compiler.
0

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

Have you included the js file in your project?
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.