Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit 3e35517

Browse files
authored
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.
1 parent 7890483 commit 3e35517

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

run-build.ps1

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@ if($Help)
2929

3030
# The first 'pass' call to "dotnet msbuild build.proj" has a hard-coded "WriteDynamicPropsToStaticPropsFiles" target
3131
# therefore, this call should not have other targets defined. Remove all targets passed in as 'extra parameters'.
32-
$ExtraParametersNoTargets = ""
33-
foreach ($param in $ExtraParameters.split())
32+
if ($ExtraParameters)
3433
{
35-
if((-not $param.StartsWith("/t")) -and (-not $param.StartsWith("/T")))
34+
$ExtraParametersNoTargets = $ExtraParameters.GetRange(0,$ExtraParameters.Count)
35+
foreach ($param in $ExtraParameters)
3636
{
37-
$ExtraParametersNoTargets += "{0} " -f $param
37+
if(($param.StartsWith("/t:", [StringComparison]::OrdinalIgnoreCase)) -or ($param.StartsWith("/target:", [StringComparison]::OrdinalIgnoreCase)))
38+
{
39+
$ExtraParametersNoTargets.Remove("$param") | Out-Null
40+
}
3841
}
3942
}
4043

run-build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ done
130130
argsnotargets=( )
131131
for arg in ${args[@]}
132132
do
133-
if [[ $arg != '/t'* ]] && [[ $arg != '/T'* ]]; then
134-
argsnotargets+=($arg)
133+
if [[ ${arg,,} != '/t:'* ]] && [[ ${arg,,} != '/target:'* ]]; then
134+
argsnotargets+=($arg)
135135
fi
136136
done
137137

0 commit comments

Comments
 (0)