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.
This commit is contained in:
John Beisner 2018-01-29 11:48:26 -08:00 committed by GitHub
parent 78904831f9
commit 3e35517ce8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View file

@ -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
}
}
}

View file

@ -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