Visual Studio Team Services 操作上的 Powershell 需要交互式 window 站
Powershell on Visual Studio Team Services operation requires an interactive window station
我正在尝试让持续集成系统为 Nativescript 应用程序构建工作。参考页面上的 this 注释,windows PowerShell 脚本:
start-process -FilePath PowerShell.exe -Verb Runas -Wait -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/NativeScript/nativescript-cli/production/setup/native-script.ps1'))"
应该设置 nativescript 环境。但是,当我在 PowerShell 构建步骤中将此 运行 作为 inline script
时,构建失败并显示以下输出:
Starting task: Powershell Script
******************************************************************************
. 'C:\Users\buildguest\AppData\Local\Temp\c0d7012a-0ed3-4dcd-976b-aa0ce6f6012b.ps1'
Executing the following powershell script. (workingFolder = C:\a\s)
C:\Users\buildguest\AppData\Local\Temp\c0d7012a-0ed3-4dcd-976b-aa0ce6f6012b.ps1
start-process : This command cannot be run due to the error: This operation requires an interactive window station.
At C:\Users\buildguest\AppData\Local\Temp\c0d7012a-0ed3-4dcd-976b-aa0ce6f6012b.ps1:1 char:1
+ start-process -FilePath PowerShell.exe -Verb Runas -Wait -ArgumentList "-NoProfi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
Process completed with exit code 0 and had 1 error(s) written to the error stream.
******************************************************************************
Finishing task: PowerShell
******************************************************************************
Task PowerShell failed. This caused the job to fail. Look at the logs for the task for more details.
我认为这意味着如果本地计算机有 GUI,脚本仅 运行s?远程托管构建服务器显然不是这种情况。如果我的假设是正确的,有没有办法解决这个问题,或者消除对 GUI 的依赖?
更新:
Here 是我尝试从此脚本中删除所有用户交互的尝试,但我仍然得到相同的结果...
更新:
******************************************************************************
Starting task: Run C:\NPM\Modules\tns.cmd
******************************************************************************
Executing the following command-line. (workingFolder = C:\a\s)
C:\NPM\Modules\tns.cmd build android
Error message highlight pattern:
Warning message highlight pattern:
[31;1mNo project found at or above 'C:\a\s' and neither was a --path specified.[0m
# build android
ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
Γöé Usage Γöé Synopsis Γöé
Γöé General Γöé $ tns build android [--compileSdk <API Level>] [--key-store-path <File Path> --key-store-password <Password> --key-store-alias <Name> --key-store-alias-password <Password>] [--release] [--static-bindings] [--copy-to <File Path>] Γöé
ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
Builds the project for Android and produces an APK that you can manually deploy on device or in the native emulator.
### Options
* --compileSdk - Sets the Android SDK that will be used to build the project.
* --release - If set, produces a release build. Otherwise, produces a debug build. When set, you must also specify the --key-store-* options.
* --key-store-path - Specifies the file path to the keystore file (P12) which you want to use to code sign your APK. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
* --key-store-password - Provides the password for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
* --key-store-alias - Provides the alias for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
* --key-store-alias-password - Provides the password for the alias specified with --key-store-alias-password. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
* --static-bindings - This is an experimental feature. If set, generates static bindings from your JavaScript code to corresponding native Android APIs during build. This static bindings speed up app loading.**
* --copy-to - Specifies the file path where the built .apk will be copied. If it points to a non-existent directory, it will be created. If the specified value is directory, the original file name will be used.
** By default, NativeScript runtime for Android uses runtime binding generator. When you extend a Java class and overwrite a lot of methods, this could be a potentially slow operation.
### Attributes
<API Level> is a valid Android API level. For example: 22, 23.
Sending exception report (press Ctrl+C to stop).....
******************************************************************************
Finishing task: CmdLine
******************************************************************************
Task CmdLine failed. This caused the job to fail. Look at the logs for the task for more details.
******************************************************************************
Note: You can use $(Build.SourcesDirectory)\ if you want the path relative to repo.
我假设问题出在您尝试自行提升当前脚本的部分。尝试直接使用流程 API 而不是 Start-Process cmdlet。这也节省了往返重新下载脚本的时间。
# Create a new process object that starts PowerShell
$newProcess = New-Object System.Diagnostics.ProcessStartInfo "PowerShell";
# Specify the current script path and name as a parameter
$newProcess.Arguments = $myInvocation.MyCommand.Definition;
# Indicate that the process should be elevated
$newProcess.Verb = "runas";
# Start the new process
[System.Diagnostics.Process]::Start($newProcess);
# Exit from the current, unelevated process
exit
就像 Alistair 指出的那样,问题可能是由这个块引起的:
# Self-elevate
$isElevated = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]"Administrator")
if (-not $isElevated) {
start-process -FilePath PowerShell.exe -Verb Runas -Wait -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/NativeScript/nativescript-cli/production/setup/native-script.ps1'))"
exit 0
}
而且我认为您无法在构建机器上安装 Chocolatey/Java/Android SDK,因为我怀疑您是否拥有该机器的管理员权限。但据我所知,Team Services 已经支持 Android 构建,所以我怀疑它已经安装了 Java 和 Android SDK。您是否尝试过通过 npm install -g nativescript
仅安装 nativescript 然后尝试构建您的项目?
更新
放入C:\NPM\Modules\tns.cmd
和"Tool"然后作为"Arguments"build android --path $(Build.SourcesDirectory)
基于 Peter Staev 的 post 我已经成功地在 VS Team Services 上创建了一个构建定义。它只需要 3 个步骤:
- npm 安装-g nativescript
- npm install(在高级选项下设置工作目录)
- 使用工具添加命令行任务:
C:\NPM\Modules\tns.cmd
和参数:
build android --release --key-store-path "PATH\your.keystore" --key-store-password $(keystore.password) --key-store-alias ALIAS --key-store-alias-password $(alias.password)
(您可以使用变量来保护您的密码)
我正在尝试让持续集成系统为 Nativescript 应用程序构建工作。参考页面上的 this 注释,windows PowerShell 脚本:
start-process -FilePath PowerShell.exe -Verb Runas -Wait -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/NativeScript/nativescript-cli/production/setup/native-script.ps1'))"
应该设置 nativescript 环境。但是,当我在 PowerShell 构建步骤中将此 运行 作为 inline script
时,构建失败并显示以下输出:
Starting task: Powershell Script
******************************************************************************
. 'C:\Users\buildguest\AppData\Local\Temp\c0d7012a-0ed3-4dcd-976b-aa0ce6f6012b.ps1'
Executing the following powershell script. (workingFolder = C:\a\s)
C:\Users\buildguest\AppData\Local\Temp\c0d7012a-0ed3-4dcd-976b-aa0ce6f6012b.ps1
start-process : This command cannot be run due to the error: This operation requires an interactive window station.
At C:\Users\buildguest\AppData\Local\Temp\c0d7012a-0ed3-4dcd-976b-aa0ce6f6012b.ps1:1 char:1
+ start-process -FilePath PowerShell.exe -Verb Runas -Wait -ArgumentList "-NoProfi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
Process completed with exit code 0 and had 1 error(s) written to the error stream.
******************************************************************************
Finishing task: PowerShell
******************************************************************************
Task PowerShell failed. This caused the job to fail. Look at the logs for the task for more details.
我认为这意味着如果本地计算机有 GUI,脚本仅 运行s?远程托管构建服务器显然不是这种情况。如果我的假设是正确的,有没有办法解决这个问题,或者消除对 GUI 的依赖?
更新:
Here 是我尝试从此脚本中删除所有用户交互的尝试,但我仍然得到相同的结果...
更新:
******************************************************************************
Starting task: Run C:\NPM\Modules\tns.cmd
******************************************************************************
Executing the following command-line. (workingFolder = C:\a\s)
C:\NPM\Modules\tns.cmd build android
Error message highlight pattern:
Warning message highlight pattern:
[31;1mNo project found at or above 'C:\a\s' and neither was a --path specified.[0m
# build android
ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
Γöé Usage Γöé Synopsis Γöé
Γöé General Γöé $ tns build android [--compileSdk <API Level>] [--key-store-path <File Path> --key-store-password <Password> --key-store-alias <Name> --key-store-alias-password <Password>] [--release] [--static-bindings] [--copy-to <File Path>] Γöé
ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
Builds the project for Android and produces an APK that you can manually deploy on device or in the native emulator.
### Options
* --compileSdk - Sets the Android SDK that will be used to build the project.
* --release - If set, produces a release build. Otherwise, produces a debug build. When set, you must also specify the --key-store-* options.
* --key-store-path - Specifies the file path to the keystore file (P12) which you want to use to code sign your APK. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
* --key-store-password - Provides the password for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
* --key-store-alias - Provides the alias for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
* --key-store-alias-password - Provides the password for the alias specified with --key-store-alias-password. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
* --static-bindings - This is an experimental feature. If set, generates static bindings from your JavaScript code to corresponding native Android APIs during build. This static bindings speed up app loading.**
* --copy-to - Specifies the file path where the built .apk will be copied. If it points to a non-existent directory, it will be created. If the specified value is directory, the original file name will be used.
** By default, NativeScript runtime for Android uses runtime binding generator. When you extend a Java class and overwrite a lot of methods, this could be a potentially slow operation.
### Attributes
<API Level> is a valid Android API level. For example: 22, 23.
Sending exception report (press Ctrl+C to stop).....
******************************************************************************
Finishing task: CmdLine
******************************************************************************
Task CmdLine failed. This caused the job to fail. Look at the logs for the task for more details.
******************************************************************************
Note: You can use $(Build.SourcesDirectory)\ if you want the path relative to repo.
我假设问题出在您尝试自行提升当前脚本的部分。尝试直接使用流程 API 而不是 Start-Process cmdlet。这也节省了往返重新下载脚本的时间。
# Create a new process object that starts PowerShell
$newProcess = New-Object System.Diagnostics.ProcessStartInfo "PowerShell";
# Specify the current script path and name as a parameter
$newProcess.Arguments = $myInvocation.MyCommand.Definition;
# Indicate that the process should be elevated
$newProcess.Verb = "runas";
# Start the new process
[System.Diagnostics.Process]::Start($newProcess);
# Exit from the current, unelevated process
exit
就像 Alistair 指出的那样,问题可能是由这个块引起的:
# Self-elevate
$isElevated = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]"Administrator")
if (-not $isElevated) {
start-process -FilePath PowerShell.exe -Verb Runas -Wait -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/NativeScript/nativescript-cli/production/setup/native-script.ps1'))"
exit 0
}
而且我认为您无法在构建机器上安装 Chocolatey/Java/Android SDK,因为我怀疑您是否拥有该机器的管理员权限。但据我所知,Team Services 已经支持 Android 构建,所以我怀疑它已经安装了 Java 和 Android SDK。您是否尝试过通过 npm install -g nativescript
仅安装 nativescript 然后尝试构建您的项目?
更新
放入C:\NPM\Modules\tns.cmd
和"Tool"然后作为"Arguments"build android --path $(Build.SourcesDirectory)
基于 Peter Staev 的 post 我已经成功地在 VS Team Services 上创建了一个构建定义。它只需要 3 个步骤:
- npm 安装-g nativescript
- npm install(在高级选项下设置工作目录)
- 使用工具添加命令行任务:
C:\NPM\Modules\tns.cmd
和参数:
build android --release --key-store-path "PATH\your.keystore" --key-store-password $(keystore.password) --key-store-alias ALIAS --key-store-alias-password $(alias.password)
(您可以使用变量来保护您的密码)