无法在Visual Studio 2017上选择Cordova Global [英] Cannot select Cordova Global on Visual Studio 2017

查看:77
本文介绍了无法在Visual Studio 2017上选择Cordova Global的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio 2017上有一个cordova应用程序.VS2017使用Cordova 6.3.1,但是我需要使用Cordova版本7.1.0.

I have a cordova app on visual studio 2017. VS2017 uses Cordova 6.3.1 however I need to use Cordova version 7.1.0.

因此,我必须按照此链接 https://evothings.com/doc/build/cordova-install-windows.html

So I had to install cordova globally as specified in this link https://evothings.com/doc/build/cordova-install-windows.html

然后我从项目中打开config.xml并更改了工具集名称,但是它显示了"Global Cordova Version(当前未安装)"

Then I opened config.xml from my project and went to change Toolset Name, but it shows "Global Cordova Version (not currently installed)"

有任何解决此问题的帮助吗?

Any help to fix this issue?

推荐答案

如果您已经安装了 Node.js ,您可以通过在命令行界面窗口(cmd.exe)中键入 Cordova 7.1.0 来安装:

If you have already installed Node.js, you can install Cordova 7.1.0 by typing this in a command line interface window (cmd.exe):

npm install -g cordova@7.1.0

npm install -g cordova@7.1.0

现在,由于更改CLI版本不如我们想要的可靠,我建议按照以下步骤在Visual Studio 2017中创建新应用程序:

Now, because changing the CLI version is not as reliable as we would want, I suggest to follow these steps to create your new app in Visual Studio 2017:

转到File > New > Project > Blank App (Apache Cordova)

在查看代码模式下打开config.xml并找到以下内容:

Open config.xml in View Code mode and find this:

<vs:toolsetVersion>6.3.1</vs:toolsetVersion>
<engine name="android" spec="5.2.1" />

替换为:

<vs:toolsetVersion>7.1.0</vs:toolsetVersion>
<engine name="android" spec="6.3.0" />

7.1.0是您全局安装的Cordova版本.

Where 7.1.0 is your globally installed Cordova version.

选择Device作为目标.

现在Build > Build Solution

保存,关闭并重新加载项目.当您在设计器模式下访问config.xml时,将看到 Global Cordova 7.1.0 作为所选工具集.

Save, close and reload the project. When you access config.xml in designer mode you'll see Global Cordova 7.1.0 as the selected toolset.

要进行构建,您可能需要使用外部Android SDK构建工具( API 26 ),而不是Visual Studio(API 25)提供的工具.

In order to build you may need to use the external Android SDK Build Tools (API 26) instead of the ones provided by Visual Studio (API 25).

使用 Android SDK Manager 来管理版本,无需为此获得Android Studio.

Use the Android SDK Manager to manage versions, no need to get Android Studio for this.

请记住遵循

Remember to follow the guidelines from Microsoft when changing the CLI on existing projects. However I strongly recommend creating a new one and then importing your files and adding your plugins to avoid potential problems.

这篇关于无法在Visual Studio 2017上选择Cordova Global的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆