diff --git a/.build.ps1 b/.build.ps1
index 99c98a106..20fc33578 100644
--- a/.build.ps1
+++ b/.build.ps1
@@ -1,8 +1,8 @@
param(
- [ValidateSet("net451", "netstandard1.6")]
+ [ValidateSet("net451", "netstandard2.0")]
[string]$Framework = "net451",
- [ValidateSet("Debug", "Release", "PSv3Debug", "PSv3Release")]
+ [ValidateSet("Debug", "Release", "PSv3Debug", "PSv3Release", "PSv4Release")]
[string]$Configuration = "Debug"
)
@@ -17,9 +17,9 @@ if ($BuildTask -eq "release") {
$buildData = @{
Frameworks = @{
"net451" = @{
- Configuration = @('Release', "PSV3Release")
+ Configuration = @('Release', "PSV3Release", "PSv4Release")
}
- "netstandard1.6" = @{
+ "netstandard2.0" = @{
Configuration = @('Release')
}
}
@@ -145,7 +145,7 @@ task createModule {
$itemsToCopyBinaries = @("$solutionDir\Engine\bin\$Configuration\$Framework\Microsoft.Windows.PowerShell.ScriptAnalyzer.dll",
"$solutionDir\Rules\bin\$Configuration\$Framework\Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.dll")
- if ($Framework -eq "netstandard1.6") {
+ if ($Framework -eq "netstandard2.0") {
$destinationDirBinaries = "$destinationDir\coreclr"
}
elseif ($Configuration -match 'PSv3') {
diff --git a/Engine/Engine.csproj b/Engine/Engine.csproj
index 2981cf2f6..f727116b5 100644
--- a/Engine/Engine.csproj
+++ b/Engine/Engine.csproj
@@ -2,31 +2,26 @@
1.16.1
- netstandard1.6;net451
+ netstandard2.0;net451
Microsoft.Windows.PowerShell.ScriptAnalyzer
Engine
Microsoft.Windows.PowerShell.ScriptAnalyzer
-
-
-
-
-
portable
-
+
$(DefineConstants);CORECLR
-
+
@@ -34,6 +29,10 @@
+
+
+
+
True
@@ -49,8 +48,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- $(DefineConstants);PSV3;PSV5
+ $(DefineConstants);PSV3
+
+
+
+ $(DefineConstants);PSV3;PSV4
diff --git a/Engine/PSScriptAnalyzer.psm1 b/Engine/PSScriptAnalyzer.psm1
index 78a1bbecf..6c88de4e7 100644
--- a/Engine/PSScriptAnalyzer.psm1
+++ b/Engine/PSScriptAnalyzer.psm1
@@ -15,9 +15,12 @@ if (($PSVersionTable.Keys -contains "PSEdition") -and ($PSVersionTable.PSEdition
$binaryModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath 'coreclr'
}
else {
- if ($PSVersionTable.PSVersion -lt [Version]'5.0') {
+ if ($PSVersionTable.PSVersion.Major -eq 3) {
$binaryModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath 'PSv3'
}
+ elseif ($PSVersionTable.PSVersion.Major -eq 4) {
+ $binaryModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath 'PSv4'
+ }
}
$binaryModulePath = Join-Path -Path $binaryModuleRoot -ChildPath 'Microsoft.Windows.PowerShell.ScriptAnalyzer.dll'
diff --git a/Engine/ScriptAnalyzer.cs b/Engine/ScriptAnalyzer.cs
index 67ff44e73..6a7a6ea20 100644
--- a/Engine/ScriptAnalyzer.cs
+++ b/Engine/ScriptAnalyzer.cs
@@ -1131,7 +1131,7 @@ private List GetExternalRule(string[] moduleNames)
{
dynamic description = helpContent[0].Properties["Description"];
- if (null != description && null != description.Value && description.Value.GetType().IsArray)
+ if (description != null && description.Value != null && description.Value.GetType().IsArray)
{
desc = description.Value[0].Text;
}
diff --git a/Engine/ScriptAnalyzerEngine.csproj b/Engine/ScriptAnalyzerEngine.csproj
deleted file mode 100644
index 375bcdf5e..000000000
--- a/Engine/ScriptAnalyzerEngine.csproj
+++ /dev/null
@@ -1,174 +0,0 @@
-
-
-
- Debug
- AnyCPU
- {F4BDE3D0-3EEF-4157-8A3E-722DF7ADEF60}
- Library
- false
- Microsoft.Windows.PowerShell.ScriptAnalyzer
- v4.5
- 512
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- false
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- false
-
-
- Microsoft.Windows.PowerShell.ScriptAnalyzer
-
-
- true
- bin\PSV3 Debug\
- TRACE;DEBUG;PSV3
- full
- AnyCPU
- prompt
- MinimumRecommendedRules.ruleset
-
-
- bin\PSV3 Release\
- TRACE;PSV3
- true
- pdbonly
- AnyCPU
- prompt
- MinimumRecommendedRules.ruleset
-
-
-
-
-
-
-
-
-
- False
- ..\..\..\..\..\..\fbl_srv2_ci_mgmt.binaries.amd64chk\monad\System.Management.Automation.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- True
- True
- Strings.resx
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ResXFileCodeGenerator
- Strings.Designer.cs
-
-
-
-
-
-
-
- if "PSV3 Release" == "$(ConfigurationName)" (
- GOTO psv3Release
-) else if "PSV3 Debug" == "$(ConfigurationName)" (
- GOTO psv3Debug
-) else (
- GOTO default
-)
-
-:psv3Release
-:psv3Debug
-if not exist "$(SolutionDir)out\$(SolutionName)\PSv3" (
- mkdir "$(SolutionDir)out\$(SolutionName)\PSv3"
-)
-copy /y "$(TargetPath)" "$(SolutionDir)out\$(SolutionName)\PSv3"
-GOTO end
-
-
-:default
-if not exist "$(SolutionDir)out\$(SolutionName)" (
- mkdir "$(SolutionDir)out\$(SolutionName)"
-)
-copy /y "$(TargetPath)" "$(SolutionDir)out\$(SolutionName)"
-GOTO end
-
-:end
-copy /y "$(ProjectDir)*.ps1xml" "$(SolutionDir)out\$(SolutionName)"
-copy /y "$(ProjectDir)*.psm1" "$(SolutionDir)out\$(SolutionName)"
-copy /y "$(ProjectDir)*.psd1" "$(SolutionDir)out\$(SolutionName)"
-if not exist "$(SolutionDir)out\$(SolutionName)\Settings" (
- mkdir "$(SolutionDir)out\$(SolutionName)\Settings"
-)
-copy /y "$(ProjectDir)Settings\*.psd1" "$(SolutionDir)out\$(SolutionName)\Settings"
-if not exist "$(SolutionDir)out\$(SolutionName)\en-US" (
- mkdir "$(SolutionDir)out\$(SolutionName)\en-US"
-)
-copy /y "$(SolutionDir)docs\about_*.help.txt" "$(SolutionDir)out\$(SolutionName)\en-US"
-
-
\ No newline at end of file
diff --git a/README.md b/README.md
index 1eb8dedff..db30be911 100644
--- a/README.md
+++ b/README.md
@@ -107,13 +107,17 @@ Exit
```powershell
.\buildCoreClr.ps1 -Framework net451 -Configuration Release -Build
```
- * Windows PowerShell version 3.0 and 4.0
+ * Windows PowerShell version 4.0
+ ```powershell
+ .\buildCoreClr.ps1 -Framework net451 -Configuration PSV4Release -Build
+ ```
+ * Windows PowerShell version 3.0
```powershell
.\buildCoreClr.ps1 -Framework net451 -Configuration PSV3Release -Build
```
* PowerShell Core
```powershell
- .\buildCoreClr.ps1 -Framework netstandard1.6 -Configuration Release -Build
+ .\buildCoreClr.ps1 -Framework netstandard2.0 -Configuration Release -Build
```
* Build documenatation
```powershell
diff --git a/Rules/Rules.csproj b/Rules/Rules.csproj
index 43a19ea2e..ddefe13be 100644
--- a/Rules/Rules.csproj
+++ b/Rules/Rules.csproj
@@ -2,20 +2,16 @@
1.16.1
- netstandard1.6;net451
+ netstandard2.0;net451
Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
Rules
- $(PackageTargetFallback)
- 1.0.4
+ $(PackageTargetFallback)
+ 1.0.4
Microsoft.Windows.PowerShell.ScriptAnalyzer
-
-
-
-
@@ -30,14 +26,10 @@
portable
-
+
$(DefineConstants);CORECLR
-
-
-
-
True
@@ -53,8 +45,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- $(DefineConstants);PSV3;PSV5
+ $(DefineConstants);PSV3
+
+
+
+ $(DefineConstants);PSV3;PSV4
diff --git a/Rules/ScriptAnalyzerBuiltinRules.csproj b/Rules/ScriptAnalyzerBuiltinRules.csproj
deleted file mode 100644
index 007d27da1..000000000
--- a/Rules/ScriptAnalyzerBuiltinRules.csproj
+++ /dev/null
@@ -1,174 +0,0 @@
-
-
-
- Debug
- AnyCPU
- {C33B6B9D-E61C-45A3-9103-895FD82A5C1E}
- Library
- false
- Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
- v4.5
- 512
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- false
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- false
-
-
- Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
-
-
- true
- bin\PSV3 Debug\
- TRACE;DEBUG;PSV3
- full
- AnyCPU
- prompt
- MinimumRecommendedRules.ruleset
-
-
- bin\PSV3 Release\
- TRACE;PSV3
- true
- pdbonly
- AnyCPU
- prompt
- MinimumRecommendedRules.ruleset
-
-
-
-
-
-
-
-
-
-
- False
- ..\..\..\..\..\..\fbl_srv2_ci_mgmt.binaries.amd64chk\monad\System.Management.Automation.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- True
- True
- Strings.resx
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {f4bde3d0-3eef-4157-8a3e-722df7adef60}
- ScriptAnalyzerEngine
-
-
-
-
- Designer
- ResXFileCodeGenerator
- Strings.Designer.cs
-
-
-
-
-
-
-
-
-if "PSV3 Release" == "$(ConfigurationName)" (
- GOTO psv3Release
-) else if "PSV3 Debug" == "$(ConfigurationName)" (
- GOTO psv3Debug
-) else (
- GOTO default
-)
-
-:psv3Release
-:psv3Debug
- if not exist "$(SolutionDir)out\$(SolutionName)\PSv3" (
- mkdir "$(SolutionDir)out\$(SolutionName)\PSv3"
- )
- copy /y "$(TargetPath)" "$(SolutionDir)out\$(SolutionName)\PSv3"
-
- GOTO end
-
-:default
- if not exist "$(SolutionDir)out\$(SolutionName)" (
- mkdir "$(SolutionDir)out\$(SolutionName)"
- )
- copy /y "$(TargetPath)" "$(SolutionDir)out\$(SolutionName)"
-
- GOTO end
-
-:end
-
-
-
\ No newline at end of file
diff --git a/Rules/UseIdenticalMandatoryParametersDSC.cs b/Rules/UseIdenticalMandatoryParametersDSC.cs
index 928be1ab3..73f37645f 100644
--- a/Rules/UseIdenticalMandatoryParametersDSC.cs
+++ b/Rules/UseIdenticalMandatoryParametersDSC.cs
@@ -1,6 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
+// this rule can only compile on v4+
+#if (PSV4 || !PSV3)
+
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -335,5 +338,4 @@ private FileInfo GetModuleManifest(string fileName)
}
}
-
-
+#endif
diff --git a/Utils/ReleaseMaker.psm1 b/Utils/ReleaseMaker.psm1
index aba151ecc..3c0d244b4 100644
--- a/Utils/ReleaseMaker.psm1
+++ b/Utils/ReleaseMaker.psm1
@@ -95,7 +95,7 @@ function New-ReleaseBuild
remove-item out/ -recurse -force
.\buildCoreClr.ps1 -Framework net451 -Configuration Release -Build
.\buildCoreClr.ps1 -Framework net451 -Configuration PSV3Release -Build
- .\buildCoreClr.ps1 -Framework netstandard1.6 -Configuration Release -Build
+ .\buildCoreClr.ps1 -Framework netstandard2.0 -Configuration Release -Build
.\build.ps1 -BuildDocs
}
finally
diff --git a/appveyor.yml b/appveyor.yml
index ef8d68836..5c6fde606 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -8,7 +8,7 @@ environment:
BuildConfiguration: Release
- APPVEYOR_BUILD_WORKER_IMAGE: WMF 4
PowerShellEdition: WindowsPowerShell
- BuildConfiguration: PSv3Release
+ BuildConfiguration: PSv4Release
- APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu
PowerShellEdition: PowerShellCore
BuildConfiguration: Release
@@ -21,10 +21,24 @@ cache:
install:
- ps: if ($env:PowerShellEdition -eq 'WindowsPowerShell') { Import-Module .\tools\appveyor.psm1; Invoke-AppveyorInstall }
- pwsh: if ($env:PowerShellEdition -eq 'PowerShellCore') { Import-Module .\tools\appveyor.psm1; Invoke-AppveyorInstall }
+ - ps: |
+ # Windows image still has version 6.0.0 of pwsh but 6.0.2 is required due to System.Management.Automation package https://github.com/appveyor/ci/issues/2230
+ if ($env:PowerShellEdition -eq 'PowerShellCore' -and $PSVersionTable.PSVersion -lt [version]'6.0.2' -and $IsWindows) {
+ $msiPath = "$env:TEMP\PowerShell-6.0.2-win-x64.msi"
+ (New-Object Net.WebClient).DownloadFile('https://github.com/PowerShell/PowerShell/releases/download/v6.0.2/PowerShell-6.0.2-win-x64.msi', $msiPath)
+ Write-Verbose 'Installing pwsh 6.0.2' -Verbose
+ Start-Process 'msiexec.exe' -Wait -ArgumentList "/i $msiPath /quiet"
+ Remove-Item $msiPath
+ $env:Path = "$env:ProgramFiles\PowerShell\6.0.2;$env:Path"
+ }
build_script:
- ps: |
if ($env:PowerShellEdition -eq 'WindowsPowerShell') {
+ if ($env:BuildConfiguration -eq 'PSv4Release') {
+ # On WMF$: Also build for v3 to check it builds at least since we do not have a WMF3 image
+ Invoke-AppveyorBuild -CheckoutPath $env:APPVEYOR_BUILD_FOLDER -BuildConfiguration PSv3Release -BuildType 'FullCLR'
+ }
Invoke-AppveyorBuild -CheckoutPath $env:APPVEYOR_BUILD_FOLDER -BuildConfiguration $env:BuildConfiguration -BuildType 'FullCLR'
}
- pwsh: |
diff --git a/buildCoreClr.ps1 b/buildCoreClr.ps1
index e9655e24c..b8878299e 100644
--- a/buildCoreClr.ps1
+++ b/buildCoreClr.ps1
@@ -3,14 +3,14 @@
[switch]$Uninstall,
[switch]$Install,
- [ValidateSet("net451", "netstandard1.6")]
- [string]$Framework = "netstandard1.6",
+ [ValidateSet("net451", "netstandard2.0")]
+ [string]$Framework = "netstandard2.0",
- [ValidateSet("Debug", "Release", "PSv3Debug", "PSv3Release")]
+ [ValidateSet("Debug", "Release", "PSv3Debug", "PSv3Release", "PSv4Release")]
[string]$Configuration = "Debug"
)
-if ($Configuration -match "PSv3" -and $Framework -eq "netstandard1.6")
+if ($Configuration -match "PSv3" -and $Framework -eq "netstandard2.0")
{
throw ("{0} configuration is not applicable to {1} framework" -f $Configuration,$Framework)
}
@@ -32,13 +32,16 @@ $itemsToCopyCommon = @("$solutionDir\Engine\PSScriptAnalyzer.psd1",
$destinationDir = "$solutionDir\out\PSScriptAnalyzer"
$destinationDirBinaries = $destinationDir
-if ($Framework -eq "netstandard1.6")
+if ($Framework -eq "netstandard2.0")
{
$destinationDirBinaries = "$destinationDir\coreclr"
}
elseif ($Configuration -match 'PSv3') {
$destinationDirBinaries = "$destinationDir\PSv3"
}
+elseif ($Configuration -match 'PSv4') {
+ $destinationDirBinaries = "$destinationDir\PSv4"
+}
if ($build)
{
diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1
index bbac9a0a2..70ee9ec10 100644
--- a/tools/appveyor.psm1
+++ b/tools/appveyor.psm1
@@ -44,7 +44,7 @@ function Invoke-AppVeyorBuild {
$BuildType,
[Parameter(Mandatory)]
- [ValidateSet('Release', 'PSv3Release')]
+ [ValidateSet('Release', 'PSv4Release', 'PSv4Release')]
$BuildConfiguration,
[Parameter(Mandatory)]
@@ -61,7 +61,7 @@ function Invoke-AppVeyorBuild {
.\buildCoreClr.ps1 -Framework net451 -Configuration $BuildConfiguration -Build
}
elseif ($BuildType -eq 'NetStandard') {
- .\buildCoreClr.ps1 -Framework netstandard1.6 -Configuration Release -Build
+ .\buildCoreClr.ps1 -Framework netstandard2.0 -Configuration Release -Build
}
.\build.ps1 -BuildDocs
Pop-Location