Understand Visual Studio Tools for Apache Cordova

Recently I turned to Cordova for building a new version of my app, as I am a Visual Studio user, it’s great to get an official tools from Microsoft for Cordova.

Cordova is a tool for building web applications running in native shell. Due to the nature of web apps, and the effort make by Cordova team and its ecosystem, Cordova is also a great tool to build cross-platform apps.

Actually, Cordova also provide a way to develop web apps dedicated to a specific platform. Though that won’t be discussed in this post.

For building cross-platform web apps, refer to http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html

After creating a Cordova project, a “www” folder will be created with some initial files. The major project usually goes here. And there’s also a “platforms” folder that holds the project files for each platforms.

However, once a specific platform is added to your Cordova project, Cordova will leave most of the files as they are. This means that you may actually open a specific platform folder as a project in your IDE, edit and debug them.

Though these “most of the files” does not include cross-platform contents, e.g. contents in folder “www”.

The situation for plugins is quite the same, after the installation of plugins, Cordova will not touch the files that have already been generated, even if they’ve been changed by you.

This is what’s going on with Cordova CLI, however, not Visual Studio Tools for Apache Cordova.

Let’s put the directory structures of original Cordova and VS Tools together and we’ll be able to understand the differences.

Cordova CLI
- project
  - platforms
    - wp8
      - www
  - plugins
  - www
  - config.xml

VS Tools
- project
  - bld
    - Debug
      - platforms
        - wp8
          - www
      - plugins
      - www
      - config.xml
  - plugins
  - config.xml

VS Tools treat the entire project folder as “www” except for some special ones for Cordova. But after all it’s a tool box for Cordova, what’s their connection?

Basically a project defined by Visual Studio Tools for Cordova is not a real Cordova project, but a project that this tool will manage to convert to Cordova projects based on your configuration.

So what you see in bld\Debug\ (or Release) folder is the actual Cordova project.

I mentioned that Cordova won’t touch most of the files once they are generated. This good, but sometimes it will bring problems (e.g. install then uninstall plugins). However, the way Visual Studio Tools use brings also problems, and maybe even more…?

For example the installation of plugins does not support variables, and editing native projects is really painful.

But hoping they will solve these problems soon in the future when it goes to RTM.

Checkout Visual Studio Tools for Apache Cordova (CTP3).

Original link of this archive: http://vilic.info/blog/archives/1172
本文的原始链接: http://vilic.info/blog/archives/1172

Leave a Reply

Your email address will not be published. Required fields are marked *

Note: You can reply a specific commenter by using "@+user+blank" grammar (case sensitive), and then an email will be sent to notify he/she that you have replied.