Skip to content

Commit a17699b

Browse files
committed
Upgrade system.automation.management to 6.0.1.1 for netstandard, which required upgrade from netstandard 1.6 to netstandard2.0,which included some breaking changes in netstandard2.0 that required some more nuget packges.
1 parent 367384a commit a17699b

File tree

8 files changed

+41
-31
lines changed

8 files changed

+41
-31
lines changed

.build.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
param(
2-
[ValidateSet("net451", "netstandard1.6")]
2+
[ValidateSet("net451", "netstandard2.0")]
33
[string]$Framework = "net451",
44

55
[ValidateSet("Debug", "Release", "PSv3Debug", "PSv3Release")]
@@ -19,7 +19,7 @@ if ($BuildTask -eq "release") {
1919
"net451" = @{
2020
Configuration = @('Release', "PSV3Release")
2121
}
22-
"netstandard1.6" = @{
22+
"netstandard2.0" = @{
2323
Configuration = @('Release')
2424
}
2525
}
@@ -145,7 +145,7 @@ task createModule {
145145
$itemsToCopyBinaries = @("$solutionDir\Engine\bin\$Configuration\$Framework\Microsoft.Windows.PowerShell.ScriptAnalyzer.dll",
146146
"$solutionDir\Rules\bin\$Configuration\$Framework\Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.dll")
147147

148-
if ($Framework -eq "netstandard1.6") {
148+
if ($Framework -eq "netstandard2.0") {
149149
$destinationDirBinaries = "$destinationDir\coreclr"
150150
}
151151
elseif ($Configuration -match 'PSv3') {

Engine/Engine.csproj

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,37 @@
22

33
<PropertyGroup>
44
<VersionPrefix>1.16.1</VersionPrefix>
5-
<TargetFrameworks>netstandard1.6;net451</TargetFrameworks>
5+
<TargetFrameworks>netstandard2.0;net451</TargetFrameworks>
66
<AssemblyName>Microsoft.Windows.PowerShell.ScriptAnalyzer</AssemblyName>
77
<PackageId>Engine</PackageId>
88
<RootNamespace>Microsoft.Windows.PowerShell.ScriptAnalyzer</RootNamespace> <!-- Namespace needs to match Assembly name for ressource binding -->
99
</PropertyGroup>
1010

11-
<ItemGroup>
12-
<PackageReference Include="System.Management.Automation" Version="6.0.0-alpha13" />
13-
</ItemGroup>
14-
1511
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
1612
<Reference Include="System.ComponentModel.Composition" />
1713
<Reference Include="System" />
18-
<Reference Include="Microsoft.CSharp" />
1914
</ItemGroup>
2015

2116
<PropertyGroup Condition=" '$(TargetFramework)' == 'net451' ">
2217
<DebugType>portable</DebugType>
2318
</PropertyGroup>
2419

25-
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
20+
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
2621
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
2722
</PropertyGroup>
2823

29-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
24+
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
3025
<Compile Remove="SafeDirectoryCatalog.cs" />
3126
</ItemGroup>
3227

3328
<ItemGroup>
3429
<Compile Remove="Commands\GetScriptAnalyzerLoggerCommand.cs" />
3530
</ItemGroup>
3631

32+
<ItemGroup>
33+
<PackageReference Include="Microsoft.CSharp" Version="4.4.1" />
34+
</ItemGroup>
35+
3736
<ItemGroup>
3837
<Compile Update="Strings.Designer.cs">
3938
<DesignTime>True</DesignTime>
@@ -49,6 +48,14 @@
4948
</EmbeddedResource>
5049
</ItemGroup>
5150

51+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
52+
<PackageReference Include="System.Management.Automation" Version="6.0.1.1" />
53+
</ItemGroup>
54+
55+
<ItemGroup Condition="'$(TargetFramework)' == 'net451'">
56+
<PackageReference Include="System.Management.Automation" Version="6.0.0-alpha13" />
57+
</ItemGroup>
58+
5259
<PropertyGroup Condition=" '$(Configuration)' == 'PSV3Release' ">
5360
<DefineConstants>$(DefineConstants);PSV3;PSV5</DefineConstants>
5461
</PropertyGroup>

Engine/ScriptAnalyzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ private List<ExternalRule> GetExternalRule(string[] moduleNames)
11411141
{
11421142
dynamic description = helpContent[0].Properties["Description"];
11431143

1144-
if (null != description && null != description.Value && description.Value.GetType().IsArray)
1144+
if (description != null && description.Value != null && description.Value.GetType().IsArray)
11451145
{
11461146
desc = description.Value[0].Text;
11471147
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Exit
109109
```
110110
* PowerShell Core
111111
```powershell
112-
.\buildCoreClr.ps1 -Framework netstandard1.6 -Configuration Release -Build
112+
.\buildCoreClr.ps1 -Framework netstandard2.0 -Configuration Release -Build
113113
```
114114
* Build documenatation
115115
```powershell

Rules/Rules.csproj

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,16 @@
22

33
<PropertyGroup>
44
<VersionPrefix>1.16.1</VersionPrefix>
5-
<TargetFrameworks>netstandard1.6;net451</TargetFrameworks>
5+
<TargetFrameworks>netstandard2.0;net451</TargetFrameworks>
66
<AssemblyName>Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules</AssemblyName>
77
<PackageId>Rules</PackageId>
8-
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback)</PackageTargetFallback>
9-
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netstandard1.6' ">1.0.4</RuntimeFrameworkVersion>
8+
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard2.0' ">$(PackageTargetFallback)</PackageTargetFallback>
9+
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netstandard2.0' ">1.0.4</RuntimeFrameworkVersion>
1010
<RootNamespace>Microsoft.Windows.PowerShell.ScriptAnalyzer</RootNamespace> <!-- Namespace needs to match Assembly name for ressource binding -->
1111
</PropertyGroup>
1212

1313
<ItemGroup>
1414
<ProjectReference Include="..\Engine\Engine.csproj" />
15-
</ItemGroup>
16-
17-
<ItemGroup>
18-
<PackageReference Include="System.Management.Automation" Version="6.0.0-alpha13" />
1915
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
2016
</ItemGroup>
2117

@@ -30,14 +26,10 @@
3026
<DebugType>portable</DebugType>
3127
</PropertyGroup>
3228

33-
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
29+
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
3430
<DefineConstants>$(DefineConstants);CORECLR</DefineConstants>
3531
</PropertyGroup>
3632

37-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
38-
<Compile Remove="UseSingularNouns.cs" />
39-
</ItemGroup>
40-
4133
<ItemGroup>
4234
<Compile Update="Strings.Designer.cs">
4335
<DesignTime>True</DesignTime>
@@ -53,6 +45,17 @@
5345
</EmbeddedResource>
5446
</ItemGroup>
5547

48+
<ItemGroup Condition="'$(TargetFramework)' == 'net451'">
49+
<PackageReference Include="System.Management.Automation" Version="6.0.0-alpha13" />
50+
</ItemGroup>
51+
52+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
53+
<PackageReference Include="System.Management.Automation" Version="6.0.1.1" />
54+
<PackageReference Include="Microsoft.Management.Infrastructure" Version="1.0.0-alpha08" />
55+
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.5.0-preview1-26216-02" />
56+
<Compile Remove="UseSingularNouns.cs" />
57+
</ItemGroup>
58+
5659
<PropertyGroup Condition=" '$(Configuration)' == 'PSV3Release' ">
5760
<DefineConstants>$(DefineConstants);PSV3;PSV5</DefineConstants>
5861
</PropertyGroup>

Utils/ReleaseMaker.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function New-ReleaseBuild
9595
remove-item out/ -recurse -force
9696
.\buildCoreClr.ps1 -Framework net451 -Configuration Release -Build
9797
.\buildCoreClr.ps1 -Framework net451 -Configuration PSV3Release -Build
98-
.\buildCoreClr.ps1 -Framework netstandard1.6 -Configuration Release -Build
98+
.\buildCoreClr.ps1 -Framework netstandard2.0 -Configuration Release -Build
9999
.\build.ps1 -BuildDocs
100100
}
101101
finally

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ build_script:
5252
Write-Verbose ".NET SDK version: $(dotnet --version)" -Verbose
5353
Push-Location C:\projects\psscriptanalyzer
5454
# Test build using netstandard to test whether APIs are being called that are not available in .Net Core. Remove output afterwards.
55-
.\buildCoreClr.ps1 -Framework netstandard1.6 -Configuration Release -Build
55+
.\buildCoreClr.ps1 -Framework netstandard2.0 -Configuration Release -Build
5656
git clean -dfx
5757
C:\projects\psscriptanalyzer\buildCoreClr.ps1 -Framework net451 -Configuration $env:BuildConfiguration -Build
5858
C:\projects\psscriptanalyzer\build.ps1 -BuildDocs

buildCoreClr.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
[switch]$Uninstall,
44
[switch]$Install,
55

6-
[ValidateSet("net451", "netstandard1.6")]
7-
[string]$Framework = "netstandard1.6",
6+
[ValidateSet("net451", "netstandard2.0")]
7+
[string]$Framework = "netstandard2.0",
88

99
[ValidateSet("Debug", "Release", "PSv3Debug", "PSv3Release")]
1010
[string]$Configuration = "Debug"
1111
)
1212

13-
if ($Configuration -match "PSv3" -and $Framework -eq "netstandard1.6")
13+
if ($Configuration -match "PSv3" -and $Framework -eq "netstandard2.0")
1414
{
1515
throw ("{0} configuration is not applicable to {1} framework" -f $Configuration,$Framework)
1616
}
@@ -32,7 +32,7 @@ $itemsToCopyCommon = @("$solutionDir\Engine\PSScriptAnalyzer.psd1",
3232

3333
$destinationDir = "$solutionDir\out\PSScriptAnalyzer"
3434
$destinationDirBinaries = $destinationDir
35-
if ($Framework -eq "netstandard1.6")
35+
if ($Framework -eq "netstandard2.0")
3636
{
3737
$destinationDirBinaries = "$destinationDir\coreclr"
3838
}

0 commit comments

Comments
 (0)