Search code examples
cordovavisual-studio-cordovavisual-studio-2015

VS2015 Build Not Executing node hooks and no errors


I am using VS2015 Community Edition, Update 3, the latest TACO and Ionic frameworks on Windows 10 home Edition.

I have some before_prepare Cordova hooks defined in config.xml to copy some files into www/lib.

I notice that my hooks are called as expected if I call cordova prepare or cordova build from the command line, but when I do a Visual Studio build, it does not call them.

For awhile, it was actually opening up the .js files in my text editor instead of executing. I found an article that discussed how the BOM in the file encoding was throwing off Visual Studio, so I have made sure all these .js files are ASCII encoding. Now the files don't autoopen in Notepad++, but they also still don't execute and there are no errors.

I have tried with and without the #!/usr/bin/env node line at the top.

When i do a debug build for Android, I'm getting nothing like I see when I do the Cordova CLI build:

>------ Build started: Project: Wenzaa, Configuration: Debug Android ------
1>  ------ Ensuring correct global installation of package from source package directory: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\ApacheCordovaTools\packages\vs-tac
1>  ------ Name from source package.json: vs-tac
1>  ------ Version from source package.json: 1.0.42
1>  ------ Package already installed globally at correct version.
1>  ------ Cordova tools 6.1.1 already installed.
1>  ------ Build Settings:
1>  ------ Build Settings:
1>  ------    platformConfigurationBldDir: D:\MOBILEDEV\ionic\Wenzaa\Wenzaa\bld\Android\Debug
1>  ------    platformConfigurationBinDir: D:\MOBILEDEV\ionic\Wenzaa\Wenzaa\bin\Android\Debug
1>  ------    buildCommand: prepare
1>  ------    platform: Android
1>  ------    cordovaPlatform: android
1>  ------    configuration: Debug
1>  ------    cordovaConfiguration: Debug
1>  ------    projectName: Wenzaa
1>  ------    projectSourceDir: D:\MOBILEDEV\ionic\Wenzaa\Wenzaa
1>  ------    npmInstallDir: C:\Users\Jesse\AppData\Roaming\npm
1>  ------    language: en-US
1>  ------ Platform android already exists
1>  ------ Updating plugins
1>  ------ Currently installed plugins: [email protected],[email protected],[email protected],[email protected],[email protected]
1>  ------ Currently installed dependent plugins:
1>  ------ Currently configured plugins:
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

I tried repairing the Apache Tools for Cordova via the programs and Features panel ("Repair option"). Not sure why but it appears I have it installed as a separate package AS WELL as the options via the Visual Studio components install. Could this be it?


Solution

  • In reviewing the Cordova Hooks Guide, it appears I have assigned before_prepare hooks, which aren't actually supposed to run during a compile. By moving them to before_compile, they will run. However, the dependent packages I have don't change frequently, so I may keep them in before_prepare and simply use cordova prepare CLI command when/if I update the dependent packages.