Installing Plugins to Visual Studio Cordova project

二次信任 提交于 2019-12-10 13:36:45

问题


I have a new blank cordova project that I would like to install a plugin into,

http://plugreg.com/plugin/EddyVerbruggen/LaunchMyApp-PhoneGap-Plugin

I've tried the following,

  1. open up cmd
  2. browse to application folder, containing .sln file
  3. install cordova using npm
  4. run 'cordova plugin add https://github.com/EddyVerbruggen/LaunchMyApp-PhoneGap-Plugin.git'

I receive the following error,

'Current working directory is not a Cordova-based project.'

Any idea how I get this to work, assuming that I can that is?


回答1:


Visual Studio Tools for Apache Cordova CPT3.0 added feature to add custom plugin, now you can use config.xml to add plugin from Git.

You can get more detail to install Visual Studio Tools for Apache Cordova CPT3.0 here. CPT3.0 requires to uninstall CPT2.0 and install Visual Studio Update 4 before installing CPT3.0




回答2:


Could be that your solution only contains the www folder of a phonegap plugin. While the actual root folder of a real phonegap application is a level above the www folder and contains folders like platform and others. Make sure the execute the command on the folder on level above or it won't recognize it indeed!




回答3:


okay so what you do is as follows,

  1. create a 'plugins' folder in your project root
  2. download the plugin git repository
  3. unpack the git repository to the plugins folder created in 1, so your folder structure should look something like myproject\plugins\myplugin\plugin.xml
  4. edit the plugin.xml
  5. change any preference elements as follows,

so the following is change like so, preference to param

<preference name="URL_SCHEME" />
<param name="URL_SCHEME" value="myvdesiredvalue" />


来源:https://stackoverflow.com/questions/25721215/installing-plugins-to-visual-studio-cordova-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!