Search code examples
visual-studiotypescriptvisual-studio-cordovaautosaveapache-cordova

Visual Studio 2015 Apache Cordova with TypeScript


I'm using Visual Studio 2015 Update 2 with Apache Cordova Tools Update 8 and TypeScript 1.8.29.

I can't get working the "Build on Save" feature, i tryied to manualy change the property on the project file:

<TypeScriptCompileOnSaveEnabled>true</TypeScriptCompileOnSaveEnabled>

I really need this feature because if VS don't build when i save every time i modify something i must stop debugging, build again, and restart.

I'm sure this should work exactly like less/sass: Modify -> Save -> Build -> Automatic refresh of app.

The part Save -> Automatic/Manual refresh works well, i saw it on css and js.


Solution

  • You need to turn on the "Automatically compile typescript which are not part of a project" option.

    open VS->Tools Menu->options->Text Editor->Type Script->Project->check on "automatically compile typescript which are not part of a project".

    Please note:

    There are two "appBundle.js" files in your project ("/scripts/www/scripts/appBundle.js" and "/www/scripts/appBundly.js"). CompileOnSave only compiles codes to "/scripts/www/scripts/appBundle.js" by default.

    You can change the output file by changing the "out" property of "compilerOptions" in tsconfig.json file.