From 3e35517ce89c77b5e3a9bf9ac22c4490f665f0e7 Mon Sep 17 00:00:00 2001 From: John Beisner Date: Mon, 29 Jan 2018 11:48:26 -0800 Subject: [PATCH] Repairing the first pass call to 'dotnet msbuild'; CLI:master (#8488) * '$ExtraParametersNoTargets', which is used on the first pass call to 'dotnet msbuild', currently is of type 'string' not 'List'1' as is '$ExtraParameters'. This results in the non-honoring of any parameter other than parameter one. Solution: Make a copy of '$ExtraParameters' to '$ExtraParametersNoTargets' of type 'List'1' and remove the targets from the list. * Swallow the boolean output from '$ExtraParametersNoTargets.Remove' * Specifically capture "/t:" or "/target:" only. --- run-build.ps1 | 11 +++++++---- run-build.sh | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/run-build.ps1 b/run-build.ps1 index 254da25d2..c92b91b6d 100644 --- a/run-build.ps1 +++ b/run-build.ps1 @@ -29,12 +29,15 @@ if($Help) # The first 'pass' call to "dotnet msbuild build.proj" has a hard-coded "WriteDynamicPropsToStaticPropsFiles" target # therefore, this call should not have other targets defined. Remove all targets passed in as 'extra parameters'. -$ExtraParametersNoTargets = "" -foreach ($param in $ExtraParameters.split()) +if ($ExtraParameters) { - if((-not $param.StartsWith("/t")) -and (-not $param.StartsWith("/T"))) + $ExtraParametersNoTargets = $ExtraParameters.GetRange(0,$ExtraParameters.Count) + foreach ($param in $ExtraParameters) { - $ExtraParametersNoTargets += "{0} " -f $param + if(($param.StartsWith("/t:", [StringComparison]::OrdinalIgnoreCase)) -or ($param.StartsWith("/target:", [StringComparison]::OrdinalIgnoreCase))) + { + $ExtraParametersNoTargets.Remove("$param") | Out-Null + } } } diff --git a/run-build.sh b/run-build.sh index cce2ed49f..45b49428a 100755 --- a/run-build.sh +++ b/run-build.sh @@ -130,8 +130,8 @@ done argsnotargets=( ) for arg in ${args[@]} do - if [[ $arg != '/t'* ]] && [[ $arg != '/T'* ]]; then - argsnotargets+=($arg) + if [[ ${arg,,} != '/t:'* ]] && [[ ${arg,,} != '/target:'* ]]; then + argsnotargets+=($arg) fi done