diff --git a/.vscode/settings.json b/.vscode/settings.json index d5989ce35..d55f534ff 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,7 +8,7 @@ "search.exclude": { "**/node_modules": true, "**/bower_components": true, - "/PSCompatibilityAnalyzer/profiles": true, - "/PSCompatibilityAnalyzer/optional_profiles": true + "/PSCompatibilityCollector/profiles": true, + "/PSCompatibilityCollector/optional_profiles": true } } \ No newline at end of file diff --git a/Engine/Engine.csproj b/Engine/Engine.csproj index d2afcc430..5884ff39b 100644 --- a/Engine/Engine.csproj +++ b/Engine/Engine.csproj @@ -1,8 +1,8 @@  - 1.18.3 - netstandard2.0;net452 + 1.19.0 + netcoreapp3.1;netstandard2.0;net452 Microsoft.Windows.PowerShell.ScriptAnalyzer Engine Microsoft.Windows.PowerShell.ScriptAnalyzer @@ -20,7 +20,7 @@ $(DefineConstants);CORECLR - + @@ -61,7 +61,29 @@ - + + + + + $(DefineConstants);PSV7;CORECLR + + + $(DefineConstants);PSV6;CORECLR + + + + + + + + + + $(DefineConstants);PSV7;CORECLR + + + $(DefineConstants);PSV6;CORECLR + + diff --git a/Engine/PSScriptAnalyzer.psd1 b/Engine/PSScriptAnalyzer.psd1 index 60c1ed3fa..716464e34 100644 --- a/Engine/PSScriptAnalyzer.psd1 +++ b/Engine/PSScriptAnalyzer.psd1 @@ -11,7 +11,7 @@ Author = 'Microsoft Corporation' RootModule = 'PSScriptAnalyzer.psm1' # Version number of this module. -ModuleVersion = '1.18.3' +ModuleVersion = '1.19.0' # ID used to uniquely identify this module GUID = 'd6245802-193d-4068-a631-8863a4342a18' diff --git a/Engine/PSScriptAnalyzer.psm1 b/Engine/PSScriptAnalyzer.psm1 index 899f98551..e98e1c88a 100644 --- a/Engine/PSScriptAnalyzer.psm1 +++ b/Engine/PSScriptAnalyzer.psm1 @@ -9,14 +9,15 @@ $PSModuleRoot = $PSModule.ModuleBase # Import the appropriate nested binary module based on the current PowerShell version $binaryModuleRoot = $PSModuleRoot - - -if (($PSVersionTable.Keys -contains "PSEdition") -and ($PSVersionTable.PSEdition -ne 'Desktop')) { - $binaryModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath 'coreclr' +if ($PSVersionTable.PSVersion.Major -eq 7 ) { + $binaryModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath "PSv$($PSVersionTable.PSVersion.Major)" +} +elseif ($PSVersionTable.PSVersion.Major -eq 6 ) { + $binaryModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath "PSv$($PSVersionTable.PSVersion.Major)" # Minimum PowerShell Core version given by PowerShell Core support itself and # also the version of NewtonSoft.Json implicitly that PSSA ships with, # which cannot be higher than the one that PowerShell ships with. - [Version] $minimumPowerShellCoreVersion = '6.2.1' + [Version] $minimumPowerShellCoreVersion = '6.2.4' if ($PSVersionTable.PSVersion -lt $minimumPowerShellCoreVersion) { throw "Minimum supported version of PSScriptAnalyzer for PowerShell Core is $minimumPowerShellCoreVersion but current version is '$($PSVersionTable.PSVersion)'. Please update PowerShell Core." } diff --git a/Rules/Rules.csproj b/Rules/Rules.csproj index 45ebf81d6..edc553591 100644 --- a/Rules/Rules.csproj +++ b/Rules/Rules.csproj @@ -1,8 +1,8 @@  - 1.18.3 - netstandard2.0;net452 + 1.19.0 + netcoreapp3.1;netstandard2.0;net452 Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules Rules Microsoft.Windows.PowerShell.ScriptAnalyzer @@ -10,11 +10,16 @@ - - + + + + + + + @@ -42,15 +47,11 @@ - + - - - - $(DefineConstants);PSV3 @@ -67,4 +68,36 @@ $(DefineConstants);PSV3;PSV4 + + $(DefineConstants);PSV7;CORECLR + + + + + + + + $(DefineConstants);PSV6;CORECLR + + + + + + + + $(DefineConstants);PSV7;CORECLR + + + + + + + + $(DefineConstants);PSV6;CORECLR + + + + + + diff --git a/build.ps1 b/build.ps1 index 14e8a03ee..94f3cbf4e 100644 --- a/build.ps1 +++ b/build.ps1 @@ -36,12 +36,6 @@ param( [Parameter(ParameterSetName='Bootstrap')] [switch] $Bootstrap ) -BEGIN { - if ($PSVersion -gt 6) { - # due to netstandard2.0 we do not need to treat PS version 7 differently - $PSVersion = 6 - } -} END { Import-Module -Force (Join-Path $PSScriptRoot build.psm1) diff --git a/build.psm1 b/build.psm1 index 54b5d426b..5a85e3187 100644 --- a/build.psm1 +++ b/build.psm1 @@ -144,9 +144,7 @@ function Start-ScriptAnalyzerBuild param ( [switch]$All, - # Note that 6 should also be chosen for PowerShell7 as both implement netstandard2.0 - # and we do not use features from netstandard2.1 - [ValidateRange(3, 6)] + [ValidateRange(3, 7)] [int]$PSVersion = $PSVersionTable.PSVersion.Major, [ValidateSet("Debug", "Release")] @@ -178,7 +176,7 @@ function Start-ScriptAnalyzerBuild if ( $All ) { # Build all the versions of the analyzer - foreach($psVersion in 3..6) { + foreach($psVersion in 3..7) { Start-ScriptAnalyzerBuild -Configuration $Configuration -PSVersion $psVersion } return @@ -191,7 +189,10 @@ function Start-ScriptAnalyzerBuild Set-Variable -Name profilesCopied -Value $true -Scope 1 } - if ($PSVersion -ge 6) { + if ($PSVersion -eq 7) { + $framework = 'netcoreapp3.1' + } + elseif ($PSVersion -eq 6) { $framework = 'netstandard2.0' } else { @@ -199,7 +200,7 @@ function Start-ScriptAnalyzerBuild } # build the appropriate assembly - if ($PSVersion -match "[34]" -and $Framework -eq "core") + if ($PSVersion -match "[34]" -and $Framework -ne "net452") { throw ("ScriptAnalyzer for PS version '{0}' is not applicable to {1} framework" -f $PSVersion,$Framework) } @@ -231,7 +232,11 @@ function Start-ScriptAnalyzerBuild } 6 { - $destinationDirBinaries = "$script:destinationDir\coreclr" + $destinationDirBinaries = "$script:destinationDir\PSv6" + } + 7 + { + $destinationDirBinaries = "$script:destinationDir\PSv7" } default { @@ -240,7 +245,7 @@ function Start-ScriptAnalyzerBuild } $buildConfiguration = $Configuration - if ((3, 4) -contains $PSVersion) { + if ((3, 4, 6, 7) -contains $PSVersion) { $buildConfiguration = "PSV${PSVersion}${Configuration}" } diff --git a/global.json b/global.json index 1e85f0e0e..775c52f92 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "3.1.102" + "version": "3.1.101" } } diff --git a/tools/releaseBuild/FileCatalogSigning.xml b/tools/releaseBuild/FileCatalogSigning.xml index 00a95b369..6fc649112 100644 --- a/tools/releaseBuild/FileCatalogSigning.xml +++ b/tools/releaseBuild/FileCatalogSigning.xml @@ -2,7 +2,7 @@ - + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + +