Skip to main content
added 627 characters in body; added 4 characters in body
Source Link
Josh
  • 7.7k
  • 8
  • 52
  • 76

The answer is "you can't doVisual Studio now supports "compile on save" for TypeScript files. I'm using Visual Studio 2013 Update 2, and I can turn this yeton in a Web Site project by going to Tools -> Options -> Text Editor -> TypeScript -> Project, and checking the box "Automatically compile TypeScript files which are not part of a project." We'll see if Microsoft adds support forI don't know why it's labeled like this, because it is clearly compiling files which are part of my project...

InMany of the mean timeother answers to this are not applicable to Web Site Projects, your optionsbecause you can't hook into the build process. With a Web Site Project, there is no csproj or vbproj file, as the build is handled by IIS, not Visual Studio.

If you're using a Web Site Project, and "compile on save" doesn't work for you, there are only a few alternatives:

  1. Use the command line TSC compiler to manually compile your code.

  2. Create a custom tool for manually compiling your files. Unfortunately,You can configure this will only compile the currently active filefor use in Visual Studio.

  3. Create an "on-demand compilation" .aspx page that will compile the TypeScript and return it as JavaScript.

  4. Use the TypeScript Compile JavaScript project to automatically your code in the browser. This gives you the "on-demand compilation" that normally comes with Web Site Projects.

I'm using the fourth option. The disadvantage is that the browser is actually compiling your TypeScript code for you every time you load the page, and this can resultBefore "compile on save" was working in some delay before your code starts executing. HoweverVS, I still think it'swas using the fastest and easiest optionTypeScript Compile. Now I'm happily using "compile on save."

The answer is "you can't do this yet." We'll see if Microsoft adds support for this.

In the mean time, your options are:

  1. Use the command line TSC compiler to manually compile your code.

  2. Create a custom tool for manually compiling your files. Unfortunately, this will only compile the currently active file.

  3. Create an "on-demand compilation" .aspx page that will compile the TypeScript and return it as JavaScript.

  4. Use the TypeScript Compile JavaScript project to automatically your code in the browser. This gives you the "on-demand compilation" that normally comes with Web Site Projects.

I'm using the fourth option. The disadvantage is that the browser is actually compiling your TypeScript code for you every time you load the page, and this can result in some delay before your code starts executing. However, I still think it's the fastest and easiest option.

Visual Studio now supports "compile on save" for TypeScript files. I'm using Visual Studio 2013 Update 2, and I can turn this on in a Web Site project by going to Tools -> Options -> Text Editor -> TypeScript -> Project, and checking the box "Automatically compile TypeScript files which are not part of a project." I don't know why it's labeled like this, because it is clearly compiling files which are part of my project...

Many of the other answers to this are not applicable to Web Site Projects, because you can't hook into the build process. With a Web Site Project, there is no csproj or vbproj file, as the build is handled by IIS, not Visual Studio.

If you're using a Web Site Project, and "compile on save" doesn't work for you, there are only a few alternatives:

  1. Use the command line TSC compiler to manually compile your code.

  2. Create a custom tool for manually compiling your files. You can configure this for use in Visual Studio.

  3. Create an "on-demand compilation" .aspx page that will compile the TypeScript and return it as JavaScript.

  4. Use the TypeScript Compile JavaScript project to automatically your code in the browser. This gives you the "on-demand compilation" that normally comes with Web Site Projects.

Before "compile on save" was working in VS, I was using the TypeScript Compile. Now I'm happily using "compile on save."

deleted 140 characters in body
Source Link
Josh
  • 7.7k
  • 8
  • 52
  • 76

The answer is "you can't do this yet." We'll see if Microsoft adds support for this.

In the mean time, your options are:

  1. Use the command line TSC compiler to manually compile your code.

  2. Create a custom tool for manually compiling your files. Unfortunately, this will only compile the currently active file.

  3. Create an "on-demand compilation" .aspx page that will compile the TypeScript and return it as JavaScript.

  4. Use the TypeScript Compile JavaScript project to automatically your code in the browser. This gives you the "on-demand compilation" that normally comes with Web Site Projects.

I'm using the thirdfourth option. The disadvantage is that the browser is actually compiling your TypeScript code for you every time you load the page, and this can result in some delay before your code starts executing. However, I still think it's the fastest and easiest option.

Another option that I haven't explored is to create an "on-demand compilation" .aspx page that will compile the TypeScript and return it as JavaScript. I may explore this further in the future, but for now, TypeScript Compile is working fine for me.

The answer is "you can't do this yet." We'll see if Microsoft adds support for this.

In the mean time, your options are:

  1. Use the command line TSC compiler to manually compile your code.

  2. Create a custom tool for manually compiling your files. Unfortunately, this will only compile the currently active file.

  3. Use the TypeScript Compile JavaScript project to automatically your code in the browser. This gives you the "on-demand compilation" that normally comes with Web Site Projects.

I'm using the third option. The disadvantage is that the browser is actually compiling your TypeScript code for you every time you load the page, and this can result in some delay before your code starts executing. However, I still think it's the fastest and easiest option.

Another option that I haven't explored is to create an "on-demand compilation" .aspx page that will compile the TypeScript and return it as JavaScript. I may explore this further in the future, but for now, TypeScript Compile is working fine for me.

The answer is "you can't do this yet." We'll see if Microsoft adds support for this.

In the mean time, your options are:

  1. Use the command line TSC compiler to manually compile your code.

  2. Create a custom tool for manually compiling your files. Unfortunately, this will only compile the currently active file.

  3. Create an "on-demand compilation" .aspx page that will compile the TypeScript and return it as JavaScript.

  4. Use the TypeScript Compile JavaScript project to automatically your code in the browser. This gives you the "on-demand compilation" that normally comes with Web Site Projects.

I'm using the fourth option. The disadvantage is that the browser is actually compiling your TypeScript code for you every time you load the page, and this can result in some delay before your code starts executing. However, I still think it's the fastest and easiest option.

deleted 47 characters in body
Source Link
Josh
  • 7.7k
  • 8
  • 52
  • 76

The answer is "you can't do this yet." We'll see if Microsoft adds support for this.

In the mean time, your options are:

  1. Use the command line TSC compiler to manually compile your code.

  2. Create a custom tool for manually compiling your files. Unfortunately, this will only compile the currently active file.

  3. Use the TypeScript Compile JavaScript project to automatically your code in the browser. This is what I'm doing, and it has the benefit of allowinggives you the "on-demand compilation" that normally comes with Web Site Projects.

I'm using the third option. The disadvantage is that the browser is actually compiling your TypeScript code for you every time you load the page, and this can result in some delay before your code starts executing. However, I still think it's the fastest and easiereasiest option.

Another option that I haven't explored is to create an "on-demand compilation" .aspx page that will compile the TypeScript and return it as JavaScript. I may explore this further in the future, but for now, TypeScript Compile is working fine for me.

The answer is "you can't do this yet." We'll see if Microsoft adds support for this.

In the mean time, your options are:

  1. Use the command line TSC compiler to manually compile your code.

  2. Create a custom tool for manually compiling your files. Unfortunately, this will only compile the currently active file.

  3. Use the TypeScript Compile JavaScript project to automatically your code in the browser. This is what I'm doing, and it has the benefit of allowing you the "on-demand compilation" that normally comes with Web Site Projects.

I'm using the third option. The disadvantage is that the browser is actually compiling your TypeScript code for you every time you load the page, and this can result in some delay before your code starts executing. However, I still think it's the fastest and easier option.

Another option that I haven't explored is to create an "on-demand compilation" .aspx page that will compile the TypeScript and return it as JavaScript. I may explore this further in the future, but for now, TypeScript Compile is working fine for me.

The answer is "you can't do this yet." We'll see if Microsoft adds support for this.

In the mean time, your options are:

  1. Use the command line TSC compiler to manually compile your code.

  2. Create a custom tool for manually compiling your files. Unfortunately, this will only compile the currently active file.

  3. Use the TypeScript Compile JavaScript project to automatically your code in the browser. This gives you the "on-demand compilation" that normally comes with Web Site Projects.

I'm using the third option. The disadvantage is that the browser is actually compiling your TypeScript code for you every time you load the page, and this can result in some delay before your code starts executing. However, I still think it's the fastest and easiest option.

Another option that I haven't explored is to create an "on-demand compilation" .aspx page that will compile the TypeScript and return it as JavaScript. I may explore this further in the future, but for now, TypeScript Compile is working fine for me.

Source Link
Josh
  • 7.7k
  • 8
  • 52
  • 76
Loading