Skip to content

Commit

Permalink
Update to net8 and newer dep (#2586)
Browse files Browse the repository at this point in the history
* Update to net8 and newer dep

* Fix occurences of net6.0
  • Loading branch information
nohwnd authored Dec 12, 2024
1 parent 0ecf29a commit d40aaa1
Show file tree
Hide file tree
Showing 8 changed files with 197 additions and 388 deletions.
4 changes: 2 additions & 2 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ if ($Clean) {
if ($Clean) {
# Update PesterConfiguration help in about_PesterConfiguration
if ($PSVersionTable.PSVersion.Major -ge 6) {
$null = [Reflection.Assembly]::LoadFrom("$PSScriptRoot/src/csharp/Pester/bin/$Configuration/net6.0/Pester.dll")
$null = [Reflection.Assembly]::LoadFrom("$PSScriptRoot/src/csharp/Pester/bin/$Configuration/net8.0/Pester.dll")
}
else {
$null = [Reflection.Assembly]::LoadFrom("$PSScriptRoot/src/csharp/Pester/bin/$Configuration/net462/Pester.dll")
Expand Down Expand Up @@ -205,7 +205,7 @@ if ($Clean) {
, ("$PSScriptRoot/src/schemas/Cobertura/*.dtd", "$PSScriptRoot/bin/schemas/Cobertura/")
, ("$PSScriptRoot/src/schemas/JaCoCo/*.dtd", "$PSScriptRoot/bin/schemas/JaCoCo/")
, ("$PSScriptRoot/src/csharp/Pester/bin/$Configuration/net462/Pester.dll", "$PSScriptRoot/bin/bin/net462/")
, ("$PSScriptRoot/src/csharp/Pester/bin/$Configuration/net6.0/Pester.dll", "$PSScriptRoot/bin/bin/net6.0/")
, ("$PSScriptRoot/src/csharp/Pester/bin/$Configuration/net8.0/Pester.dll", "$PSScriptRoot/bin/bin/net8.0/")
)
}

Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"rollForward": "latestFeature",
"rollForward": "latestMajor",
"version": "8.0.100",
"allowPrerelease": false
}
Expand Down
2 changes: 1 addition & 1 deletion publish/filesToPublish.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'Pester.Format.ps1xml'
'PesterConfiguration.Format.ps1xml'
'bin/net462/Pester.dll'
'bin/net6.0/Pester.dll'
'bin/net8.0/Pester.dll'
'en-US/about_Pester.help.txt'
'en-US/about_PesterConfiguration.help.txt'
'schemas/Cobertura/coverage-loose.dtd'
Expand Down
6 changes: 3 additions & 3 deletions src/Pester.Types.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ if ($null -ne $configurationType) {
}

if ($PSVersionTable.PSVersion.Major -ge 6) {
$path = "$PSScriptRoot/bin/net6.0/Pester.dll"
$path = "$PSScriptRoot/bin/net8.0/Pester.dll"
# PESTER_BUILD
if ((Get-Variable -Name "PESTER_BUILD" -ValueOnly -ErrorAction Ignore)) {
$path = "$PSScriptRoot/../bin/bin/net6.0/Pester.dll"
$path = "$PSScriptRoot/../bin/bin/net8.0/Pester.dll"
}
else {
$path = "$PSScriptRoot/../bin/bin/net6.0/Pester.dll"
$path = "$PSScriptRoot/../bin/bin/net8.0/Pester.dll"
}
# end PESTER_BUILD
& $SafeCommands['Add-Type'] -Path $path
Expand Down
14 changes: 5 additions & 9 deletions src/csharp/Pester/Pester.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net462</TargetFrameworks>
<LangVersion>latest</LangVersion>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<DebugType>embedded</DebugType>
Expand All @@ -11,14 +11,10 @@
<DefineConstants>$(DefineConstants);PESTER</DefineConstants>
</PropertyGroup>

<!-- PowerShell 7.2.x is the oldest supported PowerShell version. That version is built using net6.0.
But there is a bug in 7.2.0 reference assemblies, up to 7.2.10, where the IExtens.File is missing from the reference assembly:
https://github.com/PowerShell/PowerShell/issues/16408
So we use the version released before 7.2.0 which was 7.1.7. We could probably use 7.2.10 safely as well,
-->
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="System.Management.Automation" Version="7.1.7" />
<!-- PowerShell 7.4.x is the oldest supported PowerShell version. That version is built using net8.0. -->
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<!-- Versions older than 7.4.6 have security vulnerabilities. -->
<PackageReference Include="System.Management.Automation" Version="7.4.6" />
</ItemGroup>

<!-- Windows PowerShell 5.1 is the only Windows PowerShell that is still in support, and it is built using .NET Framework 4.5.2.
Expand Down
Loading

0 comments on commit d40aaa1

Please sign in to comment.