Skip to content

Commit 68da021

Browse files
gfraiteurclaude
andcommitted
Require PowerShell 7.5+ in Build.ps1 and DockerBuild.ps1
Scripts now fail with a clear error message if run with an older PowerShell version, instructing users to use 'pwsh' instead of 'powershell'. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 812a15a commit 68da021

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/PostSharp.Engineering.BuildTools/Resources/Build.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ param(
1212
[string[]]$BuildArgs # Arguments passed to `Build.ps1` within the container.
1313
)
1414

15+
# Require PowerShell 7.5 or higher (run with pwsh, not powershell)
16+
if ($PSVersionTable.PSVersion -lt [Version]'7.5')
17+
{
18+
Write-Error "This script requires PowerShell 7.5 or higher (run with 'pwsh', not 'powershell'). Current version: $($PSVersionTable.PSVersion)"
19+
exit 1
20+
}
21+
1522
####
1623
# These settings are replaced by the generate-scripts command.
1724
$EngPath = '<ENG_PATH>'

src/PostSharp.Engineering.BuildTools/Resources/DockerBuild.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ param(
2929
[string[]]$BuildArgs # Arguments passed to `Build.ps1` within the container (or Claude prompt if -Claude is specified).
3030
)
3131

32+
# Require PowerShell 7.5 or higher (run with pwsh, not powershell)
33+
if ($PSVersionTable.PSVersion -lt [Version]'7.5')
34+
{
35+
Write-Error "This script requires PowerShell 7.5 or higher (run with 'pwsh', not 'powershell'). Current version: $($PSVersionTable.PSVersion)"
36+
exit 1
37+
}
38+
3239
####
3340
# These settings are replaced by the generate-scripts command.
3441
$EngPath = '<ENG_PATH>'

0 commit comments

Comments
 (0)