使用 NativeScript 纠正 VS 2015 ant 部署

Rectifying VS 2015 ant deployment with NativeScript

我最初使用 tns 命令行实用程序在 c:\source\project 文件夹中创建了一个项目。我很好地创建了一个新的 nativescript 项目,但是当我 运行 android:

的命令时
tns platform add android

产生错误:

Error executing commands 'ant', make sure you have ant installed and added to your PATH.

本来希望通过VS 2015的安装和NativeScript依赖的路径来纠正ant部署,但是好像不行。我设置 %ANT_HOME% 指向 VS 使用的 apache-ant 文件夹:

%ANT_HOME% = C:\Program Files (x86)\Microsoft Visual Studio 14.0\Apps\apache-ant-1.9.3

但这不能正常工作。有没有办法让 nativescript 从 VS 路径使用 ant?

以下可能有效:

  1. Close/exit 任意打开 Windows 命令 window

  2. Open/edit环境变量PATH加上C:\Program Files (x86)\Microsoft Visual Studio 14.0\Apps\apache-ant-1.9.3,然后保存。 (我假设你知道如何 edit/change 环境变量)

  3. 打开一个新命令window(具有管理员权限)

  4. 转到项目的根文件夹

  5. 键入 运行 tns platform add android 看看会发生什么