Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating Cordova version in Visual Studio 2013 Hybrid Apps

So, we're working through the Visual Studio CTP for Hybrid apps. The version with the CTP is 3.4.0 of Cordova. There are a number of fixes which we need to do app testing with and have been made in 3.5.0. Does anyone know how to update the cordova version to 3.5 inside Visual Studio (or even outside Visual Studio) to work with the new CTP functionality?

Thanks

like image 933
Joe Vivona Avatar asked Mar 19 '23 06:03

Joe Vivona


2 Answers

Update Cordova on Windows

Note: Make sure you close all instances of Visual Studio before starting this process.

  1. Download and install the latest version of Node.js from nodejs.org.
  2. Update npm. To check your current npm version run the following command in a console:

    npm -v

    To update to the last version of npm run the following command in a console (elevated As Administrator):

    npm install -g npm

  3. Update Cordova. To check your Cordova version run the following command in a console:

    cordova -v

    To update to the last version of cordova run the following command in a console (elevated As Administrator):

    npm install -g cordova

  4. Update the vs-mda version of Cordova with the latest you just installed in the previous step. Cordova is (globally) installed at %APPDATA%\npm\node_modules\cordova. vs-mda copy of Cordova is available at %APPDATA%\npm\node_modules\vs-mda\node_modules\cordova. Replace the entire content of this folder with the one of the global Cordova installation.

    1. Install missing modules (this might depend on the latest version you install). For 5.3.3 I had to install concat-map and balanced-match. If anything else is necessary it should show up in the output log when you build your Cordova project.

    npm install -g concat-map

    npm install -g balanced-match

Update Cordova on Mac

Note: Make sure you stop the vs-mda-remote agent before performing this upgrade.

  1. Open a Terminal session and run the following command:

    sudo npm update -g cordova

  2. Update the vs-mda-remote version of Cordova with the the latest you just installed in the previous step. Cordova is (globally) installed at /usr/local/lib/node_modules/cordova. vs-mda-remote copy of Cordova is available at /usr/local/lib/node_modules/vs-mda-remote/node_modules/cordova. Replace the entire content of this folder with the one of the global Cordova installation.
  3. Restart the vs-mda-remote agent.

With all these installed you should be all set to start building with the latest version of Cordova.

NOTE

Pay attention if you clear cordova cache from Visual studio options menu, you need to do this procedure again. because it will copy older version into (for me 4.0.0) %APPDATA%\npm\node_modules\vs-mda\node_modules\cordova

like image 105
Reza Avatar answered Apr 02 '23 00:04

Reza


NOTE: This works for all the platforms EXCEPT iOS. There's something hard coded somewhere else that I am still looking for. But for Android, Windows, etc (anything you can cpompile on Windows) this does solve the problem.

in %APPDATA%\npm\node_modules\vs-mda\node_modules\cordova\ there is a file called "platforms.js" In there are the URLs and versions used for each of the platforms for cordova. use the URL (on github) to check which specific versions you have/need - for example iOS had a 3.4.1. build, but android and WP7 did not. So don't just blindly change them all. Exit Visual Studio. Go into your project directory and delete everything in the bld directory. Now restart VS. Do a CLEAN on the project and then BUILD/RUN it - in the log you should see that the platform gets downloaded AND that the batch file run (create.bat) is now the new version. Hope they make this easier in the release...

like image 35
Joe Vivona Avatar answered Apr 02 '23 01:04

Joe Vivona