Skip to content

Commit bc79f87

Browse files
committed
Fix .NET and PowerShell versions for tests
PowerShell 6.2 hit end of life, so we removed it. New lowest common denominator is PowerShell 7, with `netcoreapp3.1` (upgraded from `netcoreapp2.1`). PowerShell 7.1 was updated to 7.2, along with a corresponding update from `net5.0` to `net6.0`.
1 parent 366210e commit bc79f87

File tree

4 files changed

+16
-20
lines changed

4 files changed

+16
-20
lines changed

PowerShellEditorServices.build.ps1

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@ $script:PsesCommonProps = [xml](Get-Content -Raw "$PSScriptRoot/PowerShellEditor
2424
$script:IsPreview = [bool]($script:PsesCommonProps.Project.PropertyGroup.VersionSuffix)
2525

2626
$script:NetRuntime = @{
27-
PS62 = 'netcoreapp2.1'
2827
PS7 = 'netcoreapp3.1'
29-
PS71 = 'net5.0'
28+
PS72 = 'net6.0'
3029
Desktop = 'net461'
3130
Standard = 'netstandard2.0'
3231
}
3332

34-
$script:HostCoreOutput = "$PSScriptRoot/src/PowerShellEditorServices.Hosting/bin/$Configuration/$($script:NetRuntime.PS62)/publish"
33+
$script:HostCoreOutput = "$PSScriptRoot/src/PowerShellEditorServices.Hosting/bin/$Configuration/$($script:NetRuntime.PS7)/publish"
3534
$script:HostDeskOutput = "$PSScriptRoot/src/PowerShellEditorServices.Hosting/bin/$Configuration/$($script:NetRuntime.Desktop)/publish"
3635
$script:PsesOutput = "$PSScriptRoot/src/PowerShellEditorServices/bin/$Configuration/$($script:NetRuntime.Standard)/publish"
3736
$script:VSCodeOutput = "$PSScriptRoot/src/PowerShellEditorServices.VSCode/bin/$Configuration/$($script:NetRuntime.Standard)/publish"
@@ -103,7 +102,7 @@ function Install-Dotnet {
103102
Write-Host '.NET installation complete' -ForegroundColor Green
104103
}
105104

106-
task SetupDotNet -Before Clean, Build, TestServerWinPS, TestServerPS7, TestServerPS71, TestE2E {
105+
task SetupDotNet -Before Clean, Build, TestServerWinPS, TestServerPS7, TestServerPS72, TestE2E {
107106

108107
$dotnetPath = "$PSScriptRoot/.dotnet"
109108
$dotnetExePath = if ($script:IsUnix) { "$dotnetPath/dotnet" } else { "$dotnetPath/dotnet.exe" }
@@ -237,7 +236,7 @@ task SetupHelpForTests {
237236

238237
task Build BinClean,{
239238
exec { & $script:dotnetExe publish -c $Configuration .\src\PowerShellEditorServices\PowerShellEditorServices.csproj -f $script:NetRuntime.Standard }
240-
exec { & $script:dotnetExe publish -c $Configuration .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetRuntime.PS62 }
239+
exec { & $script:dotnetExe publish -c $Configuration .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetRuntime.PS7 }
241240
if (-not $script:IsUnix)
242241
{
243242
exec { & $script:dotnetExe publish -c $Configuration .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetRuntime.Desktop }
@@ -254,7 +253,7 @@ function DotNetTestFilter {
254253

255254
task Test SetupHelpForTests,TestServer,TestE2E
256255

257-
task TestServer TestServerWinPS,TestServerPS7,TestServerPS71
256+
task TestServer TestServerWinPS,TestServerPS7,TestServerPS72
258257

259258
task TestServerWinPS -If (-not $script:IsUnix) {
260259
Set-Location .\test\PowerShellEditorServices.Test\
@@ -268,24 +267,24 @@ task TestServerPS7 {
268267
}
269268
}
270269

271-
task TestServerPS71 {
270+
task TestServerPS72 {
272271
Set-Location .\test\PowerShellEditorServices.Test\
273272
Invoke-WithCreateDefaultHook -NewModulePath $script:PSCoreModulePath {
274-
exec { & $script:dotnetExe test --logger trx -f $script:NetRuntime.PS71 (DotNetTestFilter) }
273+
exec { & $script:dotnetExe test --logger trx -f $script:NetRuntime.PS72 (DotNetTestFilter) }
275274
}
276275
}
277276

278277
task TestE2E {
279278
Set-Location .\test\PowerShellEditorServices.Test.E2E\
280279

281280
$env:PWSH_EXE_NAME = if ($IsCoreCLR) { "pwsh" } else { "powershell" }
282-
exec { & $script:dotnetExe test --logger trx -f $script:NetRuntime.PS62 (DotNetTestFilter) }
281+
exec { & $script:dotnetExe test --logger trx -f $script:NetRuntime.PS7 (DotNetTestFilter) }
283282

284283
# Run E2E tests in ConstrainedLanguage mode.
285284
if (!$script:IsUnix) {
286285
try {
287286
[System.Environment]::SetEnvironmentVariable("__PSLockdownPolicy", "0x80000007", [System.EnvironmentVariableTarget]::Machine);
288-
exec { & $script:dotnetExe test --logger trx -f $script:NetRuntime.PS62 (DotNetTestFilter) }
287+
exec { & $script:dotnetExe test --logger trx -f $script:NetRuntime.PS7 (DotNetTestFilter) }
289288
} finally {
290289
[System.Environment]::SetEnvironmentVariable("__PSLockdownPolicy", $null, [System.EnvironmentVariableTarget]::Machine);
291290
}

src/PowerShellEditorServices.Hosting/PowerShellEditorServices.Hosting.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
4+
<TargetFrameworks>netcoreapp3.1;net461</TargetFrameworks>
55
<AssemblyName>Microsoft.PowerShell.EditorServices.Hosting</AssemblyName>
66
<LangVersion>latest</LangVersion>
77
</PropertyGroup>
88

9-
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
9+
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
1010
<DefineConstants>$(DefineConstants);CoreCLR</DefineConstants>
1111
</PropertyGroup>
1212

test/PowerShellEditorServices.Test.E2E/PowerShellEditorServices.Test.E2E.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.1</TargetFramework>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>

test/PowerShellEditorServices.Test/PowerShellEditorServices.Test.csproj

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), PowerShellEditorServices.Common.props))\PowerShellEditorServices.Common.props" />
33
<PropertyGroup>
4-
<TargetFrameworks>net5.0;netcoreapp3.1;net461</TargetFrameworks>
4+
<TargetFrameworks>net6.0;netcoreapp3.1;net461</TargetFrameworks>
55
<AssemblyName>Microsoft.PowerShell.EditorServices.Test</AssemblyName>
66
<TargetPlatform>x64</TargetPlatform>
77
</PropertyGroup>
@@ -13,14 +13,11 @@
1313
<ProjectReference Include="..\..\src\PowerShellEditorServices\PowerShellEditorServices.csproj" />
1414
<ProjectReference Include="..\PowerShellEditorServices.Test.Shared\PowerShellEditorServices.Test.Shared.csproj" />
1515
</ItemGroup>
16-
<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
17-
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.1.0-preview.3" />
16+
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
17+
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.2.0-preview.3" />
1818
</ItemGroup>
1919
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
20-
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.0.2" />
21-
</ItemGroup>
22-
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
23-
<PackageReference Include="Microsoft.PowerShell.SDK" Version="6.2.4" />
20+
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.0.6" />
2421
</ItemGroup>
2522
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
2623
<PackageReference Include="Microsoft.PowerShell.5.ReferenceAssemblies" Version="1.1.0" />

0 commit comments

Comments
 (0)