Skip to content

Commit 0bef1c8

Browse files
authored
Merge pull request #1256 from bergmeister/BuildWithPowerShell7
Make it possible to build ScriptAnalyzer with PowerShell7
2 parents c3f2a20 + 6008087 commit 0bef1c8

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

build.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ param(
77
[switch]$All,
88

99
[Parameter(ParameterSetName="BuildOne")]
10-
[ValidateRange(3, 6)]
10+
[ValidateRange(3, 7)]
1111
[int]$PSVersion = $PSVersionTable.PSVersion.Major,
1212

1313
[Parameter(ParameterSetName="BuildOne")]
@@ -36,6 +36,12 @@ param(
3636
[Parameter(ParameterSetName='Bootstrap')]
3737
[switch] $Bootstrap
3838
)
39+
BEGIN {
40+
if ($PSVersion -gt 6) {
41+
# due to netstandard2.0 we do not need to treat PS version 7 differently
42+
$PSVersion = 6
43+
}
44+
}
3945

4046
END {
4147
Import-Module -Force (Join-Path $PSScriptRoot build.psm1)

build.psm1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ function Start-ScriptAnalyzerBuild
144144
param (
145145
[switch]$All,
146146

147+
# Note that 6 should also be chosen for PowerShell7 as both implement netstandard2.0
148+
# and we do not use features from netstandard2.1
147149
[ValidateRange(3, 6)]
148150
[int]$PSVersion = $PSVersionTable.PSVersion.Major,
149151

0 commit comments

Comments
 (0)