@@ -291,7 +291,7 @@ Fix steps:
291291 log " Run dotnet restore"
292292
293293 $srcProjectDirs = @ ($Options.Top , " $PSScriptRoot /src/TypeCatalogGen" , " $PSScriptRoot /src/ResGen" )
294- $testProjectDirs = Get-ChildItem " $PSScriptRoot /test/*.csproj" - Recurse | % { [System.IO.Path ]::GetDirectoryName($_ ) }
294+ $testProjectDirs = Get-ChildItem " $PSScriptRoot /test/*.csproj" - Recurse | ForEach-Object { [System.IO.Path ]::GetDirectoryName($_ ) }
295295
296296 $RestoreArguments = @ (" --verbosity" )
297297 if ($PSCmdlet.MyInvocation.BoundParameters [" Verbose" ].IsPresent) {
@@ -300,7 +300,7 @@ Fix steps:
300300 $RestoreArguments += " quiet"
301301 }
302302
303- ($srcProjectDirs + $testProjectDirs ) | % { Start-NativeExecution { dotnet restore $_ $RestoreArguments } }
303+ ($srcProjectDirs + $testProjectDirs ) | ForEach-Object { Start-NativeExecution { dotnet restore $_ $RestoreArguments } }
304304 }
305305
306306 # handle ResGen
@@ -362,9 +362,9 @@ Fix steps:
362362
363363 # Compile native resources
364364 $currentLocation = Get-Location
365- @ (" nativemsh/pwrshplugin" ) | % {
365+ @ (" nativemsh/pwrshplugin" ) | ForEach-Object {
366366 $nativeResourcesFolder = $_
367- Get-ChildItem $nativeResourcesFolder - Filter " *.mc" | % {
367+ Get-ChildItem $nativeResourcesFolder - Filter " *.mc" | ForEach-Object {
368368 $command = @"
369369cmd.exe /C cd /d "$currentLocation " "&" "$ ( $vcPath ) \vcvarsall.bat" "$NativeHostArch " "&" mc.exe -o -d -c -U "$ ( $_.FullName ) " -h "$nativeResourcesFolder " -r "$nativeResourcesFolder "
370370"@
@@ -402,7 +402,7 @@ cmd.exe /C cd /d "$location" "&" "$($vcPath)\vcvarsall.bat" "$NativeHostArch" "&
402402
403403 # Copy the binaries from the local build directory to the packaging directory
404404 $dstPath = ($script :Options ).Top
405- $FilesToCopy | % {
405+ $FilesToCopy | ForEach-Object {
406406 $srcPath = Join-Path (Join-Path (Join-Path (Get-Location ) " bin" ) $msbuildConfiguration ) " $clrTarget /$_ "
407407 log " Copying $srcPath to $dstPath "
408408 Copy-Item $srcPath $dstPath
@@ -468,7 +468,7 @@ cmd.exe /C cd /d "$location" "&" "$($vcPath)\vcvarsall.bat" "$NativeHostArch" "&
468468 # publish netcoreapp2.0 reference assemblies
469469 try {
470470 Push-Location " $PSScriptRoot /src/TypeCatalogGen"
471- $refAssemblies = Get-Content - Path " powershell.inc" | ? { $_ -like " *microsoft.netcore.app*" } | % { $_.TrimEnd (' ;' ) }
471+ $refAssemblies = Get-Content - Path " powershell.inc" | Where-Object { $_ -like " *microsoft.netcore.app*" } | ForEach-Object { $_.TrimEnd (' ;' ) }
472472 $refDestFolder = Join-Path - Path $publishPath - ChildPath " ref"
473473
474474 if (Test-Path $refDestFolder - PathType Container) {
@@ -632,7 +632,7 @@ function New-PSOptions {
632632 }
633633
634634 if (-not $Runtime ) {
635- $Runtime = dotnet -- info | % {
635+ $Runtime = dotnet -- info | ForEach-Object {
636636 if ($_ -match " RID" ) {
637637 $_ -split " \s+" | Select-Object - Last 1
638638 }
@@ -689,7 +689,7 @@ function Get-PesterTag {
689689 $alltags = @ {}
690690 $warnings = @ ()
691691
692- get-childitem - Recurse $testbase - File | ? {$_.name -match " tests.ps1" }| % {
692+ get-childitem - Recurse $testbase - File | Where-Object {$_.name -match " tests.ps1" }| ForEach-Object {
693693 $fullname = $_.fullname
694694 $tok = $err = $null
695695 $ast = [System.Management.Automation.Language.Parser ]::ParseFile($FullName , [ref ]$tok , [ref ]$err )
@@ -705,7 +705,7 @@ function Get-PesterTag {
705705 $warnings += " TAGS must be static strings, error in ${fullname} , line $lineno "
706706 }
707707 $values = $vAst.FindAll ({$args [0 ] -is " System.Management.Automation.Language.StringConstantExpressionAst" }, $true ).Value
708- $values | % {
708+ $values | ForEach-Object {
709709 if (@ (' REQUIREADMINONWINDOWS' , ' SLOW' ) -contains $_ ) {
710710 # These are valid tags also, but they are not the priority tags
711711 }
@@ -749,7 +749,7 @@ function Publish-PSTestTools {
749749 $tools = @ (
750750 @ {Path = " ${PSScriptRoot} /test/tools/TestExe" ;Output = " testexe" }
751751 )
752- if ($Options -eq $null )
752+ if ($null -eq $Options )
753753 {
754754 $Options = New-PSOptions
755755 }
@@ -894,7 +894,7 @@ function Start-PSPester {
894894 {
895895 $lines = Get-Content $outputBufferFilePath | Select-Object - Skip $currentLines
896896 $lines | Write-Host
897- if ($lines | ? { $_ -eq ' __UNELEVATED_TESTS_THE_END__' })
897+ if ($lines | Where-Object { $_ -eq ' __UNELEVATED_TESTS_THE_END__' })
898898 {
899899 break
900900 }
@@ -1859,7 +1859,7 @@ function Publish-NuGetFeed
18591859' Microsoft.WSMan.Management' ,
18601860' Microsoft.WSMan.Runtime' ,
18611861' Microsoft.PowerShell.SDK'
1862- ) | % {
1862+ ) | ForEach-Object {
18631863 if ($VersionSuffix ) {
18641864 dotnet pack " src/$_ " -- output $OutputPath -- version- suffix $VersionSuffix / p:IncludeSymbols= true
18651865 } else {
@@ -1990,7 +1990,7 @@ function Copy-MappedFiles {
19901990 # Do some intelligence to prevent shooting us in the foot with CL management
19911991
19921992 # finding base-line CL
1993- $cl = git -- git- dir= " $PSScriptRoot /.git" tag | % {if ($_ -match ' SD.(\d+)$' ) {[int ]$Matches [1 ]} } | Sort-Object - Descending | Select-Object - First 1
1993+ $cl = git -- git- dir= " $PSScriptRoot /.git" tag | ForEach-Object {if ($_ -match ' SD.(\d+)$' ) {[int ]$Matches [1 ]} } | Sort-Object - Descending | Select-Object - First 1
19941994 if ($cl ) {
19951995 log " Current base-line CL is SD:$cl (based on tags)"
19961996 } else {
@@ -2022,7 +2022,7 @@ function Copy-MappedFiles {
20222022 }
20232023
20242024 end {
2025- $map.GetEnumerator () | % {
2025+ $map.GetEnumerator () | ForEach-Object {
20262026 New-Item - ItemType Directory (Split-Path $_.Value ) - ErrorAction SilentlyContinue > $null
20272027 Copy-Item $_.Key $_.Value - Verbose:([bool ]$PSBoundParameters [' Verbose' ]) - WhatIf:$WhatIf
20282028 }
@@ -2063,7 +2063,7 @@ function Get-Mappings
20632063
20642064 end {
20652065 $map = @ {}
2066- $mapFiles | % {
2066+ $mapFiles | ForEach-Object {
20672067 $file = $_
20682068 try {
20692069 $rawHashtable = $_ | Get-Content - Raw | ConvertFrom-Json | Convert-PSObjectToHashtable
@@ -2079,7 +2079,7 @@ function Get-Mappings
20792079 $mapRoot = $mapRoot.Replace (' \' , ' /' )
20802080 }
20812081
2082- $rawHashtable.GetEnumerator () | % {
2082+ $rawHashtable.GetEnumerator () | ForEach-Object {
20832083 $newKey = if ($Root ) { Join-Path $Root $_.Key } else { $_.Key }
20842084 $newValue = if ($KeepRelativePaths ) { ($mapRoot + ' /' + $_.Value ) } else { Join-Path $mapRoot $_.Value }
20852085 $map [$newKey ] = $newValue
@@ -2110,7 +2110,7 @@ function Send-GitDiffToSd {
21102110 $patchPath = (ls (Join-Path (get-command git).Source ' ..\..' ) - Recurse - Filter ' patch.exe' ).FullName
21112111 $m = Get-Mappings - KeepRelativePaths - Root $AdminRoot
21122112 $affectedFiles = git diff -- name- only $diffArg1 $diffArg2
2113- $affectedFiles | % {
2113+ $affectedFiles | ForEach-Object {
21142114 log " Changes in file $_ "
21152115 }
21162116
@@ -2227,12 +2227,12 @@ function Convert-TxtResourceToXml
22272227 )
22282228
22292229 process {
2230- $Path | % {
2231- Get-ChildItem $_ - Filter " *.txt" | % {
2230+ $Path | ForEach-Object {
2231+ Get-ChildItem $_ - Filter " *.txt" | ForEach-Object {
22322232 $txtFile = $_.FullName
22332233 $resxFile = Join-Path (Split-Path $txtFile ) " $ ( $_.BaseName ) .resx"
22342234 $resourceHashtable = ConvertFrom-StringData (Get-Content - Raw $txtFile )
2235- $resxContent = $resourceHashtable.GetEnumerator () | % {
2235+ $resxContent = $resourceHashtable.GetEnumerator () | ForEach-Object {
22362236@'
22372237 <data name="{0}" xml:space="preserve">
22382238 <value>{1}</value>
@@ -2256,7 +2256,7 @@ function Start-XamlGen
22562256 )
22572257
22582258 Use-MSBuild
2259- Get-ChildItem - Path " $PSScriptRoot /src" - Directory | % {
2259+ Get-ChildItem - Path " $PSScriptRoot /src" - Directory | ForEach-Object {
22602260 $XamlDir = Join-Path - Path $_.FullName - ChildPath Xamls
22612261 if ((Test-Path - Path $XamlDir - PathType Container) -and
22622262 (@ (Get-ChildItem - Path " $XamlDir \*.xaml" ).Count -gt 0 )) {
@@ -2274,7 +2274,7 @@ function Start-XamlGen
22742274 throw " No .cs or .g.resources files are generated for $XamlDir , something went wrong. Run 'Start-XamlGen -Verbose' for details."
22752275 }
22762276
2277- $filesToCopy | % {
2277+ $filesToCopy | ForEach-Object {
22782278 $sourcePath = $_.FullName
22792279 Write-Verbose " Copy generated xaml artifact: $sourcePath -> $DestinationDir "
22802280 Copy-Item - Path $sourcePath - Destination $DestinationDir
@@ -2336,7 +2336,7 @@ function script:ConvertFrom-Xaml {
23362336 log " ConvertFrom-Xaml for $XamlDir "
23372337
23382338 $Pages = " "
2339- Get-ChildItem - Path " $XamlDir \*.xaml" | % {
2339+ Get-ChildItem - Path " $XamlDir \*.xaml" | ForEach-Object {
23402340 $Page = $Script :XamlProjPage -f $_.FullName
23412341 $Pages += $Page
23422342 }
@@ -2394,7 +2394,7 @@ function script:logerror([string]$message) {
23942394function script :precheck ([string ]$command , [string ]$missedMessage ) {
23952395 $c = Get-Command $command - ErrorAction SilentlyContinue
23962396 if (-not $c ) {
2397- if ($missedMessage -ne $null )
2397+ if ($null -ne $missedMessage )
23982398 {
23992399 Write-Warning $missedMessage
24002400 }
0 commit comments