2016-04-09 30 views
0

Nativescriptアプリケーションを構築するためのContinuous Integrationシステムを稼働させようとしています。ページthisノートを参照して、窓のPowerShellスクリプト:Visual Studio Team Services操作のPowershellで対話型ウィンドウステーションが必要

開始プロセス-FilePathたpowershell.exe -Verb RunAsの-wait -ArgumentList「-noprofile -ExecutionPolicyバイパス-Command IEX((新しいオブジェクトネット。 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\1\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を持っている場合、スクリプトは実行のみ意味だと思いますか?リモートでホストされるビルドサーバーでは明らかにそうではありません。私の前提が正しければ、これを回避する方法や、GUI上の依存関係を取り除く方法がありますか?

更新:

Hereは、このスクリプトからのユーザーとの対話のすべてを削除する私の試みですが、私はまだ同じ結果を得る...

更新:

****************************************************************************** 
Starting task: Run C:\NPM\Modules\tns.cmd 
****************************************************************************** 
Executing the following command-line. (workingFolder = C:\a\1\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\1\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. 
****************************************************************************** 

注:repoに相対的なパスを使用する場合は、$(Build.SourcesDirectory)\を使用できます。

答えて

2

問題は、おそらく、このブロックによって引き起こされる注意しましたマシンに管理者権限があることを疑う。しかし、私がTeam Servicesが既にAndroidビルドをサポートしていることから、JavaとAndroid SDKがすでにインストールされていると思われます。 npm install -g nativescriptでnativescriptのみをインストールしてプロジェクトを構築しようとしましたか?

UPDATE

ピーターStaevの記事をもとに、「引数」build android --path $(Build.SourcesDirectory)

+0

ありがとう!あなたは正しいと思われますが、NPMのステップを使ってnativescriptをインストールするとすぐに使えます –

+0

「警告メッセージハイライトパターン: 」「tns build android」は内部コマンドまたは外部コマンドとして認識されません、 操作可能なプログラムまたはバッチファイル.'ネイティブスクリプトコマンドを使用しようとすると、どのようにtnsをパスに追加するか、コマンドプロンプトを再起動するなどtnsが認識されますか? –

+0

@GeorgeEdwards 'C:\ NPM \ Modules \ tns'を実行可能なパスに入れて、' build android'をパラメータとして使用します。 –

1

現在のスクリプトを自己昇格させようとしているセクションに問題があるとします。 Start-Processコマンドレットではなく、プロセスAPIを直接使用してみてください。これにより、スクリプトを再ダウンロードするための往復時間も節約できます。

# 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をインストールすることができますとは思わない:アリスターよう

# 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 
+0

こんにちはアリスターは、申し訳ありません私はかなりこれは私のコードに適合する方法を見ていませんか?どちらのビットを置き換えて、現在どのようにコマンドを実行しますか? –

0

のようにC:\NPM\Modules\tns.cmdを入れて、「ツール」と私は正常VSチームサービスのビルド定義を作成しました。それはちょうど3つのステップをrequres:-g nativescript

  • NPMをインストール

    1. NPMをインストールする(高度なオプションの下に作業ディレクトリを設定)
    2. ツールで、コマンドラインタスクを追加します。

    をC:\ NPM \ Modules \ tns.cmd

    引数:

    ビルドアンドロイド - リリース - キーストアパス "PATH \ your.keystore" - キーストアパスワード$(keystore.password) - キーストアエイリアスALIAS - キーストア-alias-パスワード$(alias.password)

    (あなたはあなたのパスワードを保護するために変数を使用することができます)

  • 関連する問題