From 4ad056016af1d5ae29f10095ea627d03d49c5bb7 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 17 Apr 2018 16:21:14 +0100 Subject: [PATCH] Powershell -file doesn't handle arguments that are string[] for example; -Command does however I want this backwards compatible just incase. Fixes #255 --- project/core/tasks/PowerShellTask.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) mode change 100644 => 100755 project/core/tasks/PowerShellTask.cs diff --git a/project/core/tasks/PowerShellTask.cs b/project/core/tasks/PowerShellTask.cs old mode 100644 new mode 100755 index 30487bab6..eb8aafdbe --- a/project/core/tasks/PowerShellTask.cs +++ b/project/core/tasks/PowerShellTask.cs @@ -209,6 +209,16 @@ public string SuccessExitCodes [ReflectorProperty("buildTimeoutSeconds", Required = false)] public int BuildTimeoutSeconds { get; set; } + /// + /// CCnet 1.8 always uses -File for execution, this means that if you want to pass an array + /// of strings as an argument it screws it up, I'm adding the ability to use -Command which + /// will behave as the user expects, however this will optional for backwards compatibility + /// + /// 1.8 + /// false + [ReflectorProperty("useCommandExecution", Required = false)] + public bool UseCommandExecution { get; set; } + /// /// Run the specified PowerShell and add its output to the build results. /// @@ -395,7 +405,7 @@ private string Args(IIntegrationResult result) builder.AppendArgument("-NoProfile"); builder.AppendArgument("-NonInteractive"); - builder.AppendArgument("-file"); + builder.AppendArgument(UseCommandExecution ? "-command" : "-file"); if (!string.IsNullOrEmpty(Script)) {