Skip to content

Commit 88df416

Browse files
DavidBoikebording
andauthored
Support minimum PowerShell 7.4 as PowerShell 7.2 is now out of support (#4619)
* Support minimum PowerShell 7.4 as PowerShell 7.2 is now out of support with .NET 6 * Collection initializers * Custom exception constructors for binary serialization are now obsolete * Remove LangVersion * Use ZipFile instead of ZipArchive * Move global.json to root --------- Co-authored-by: Brandon Ording <[email protected]>
1 parent e60009a commit 88df416

26 files changed

+56
-73
lines changed

.github/workflows/build-windows.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
uses: actions/[email protected]
1919
with:
2020
dotnet-version: 8.0.x
21+
- name: dotnet info
22+
run: dotnet --info
2123
- name: Download RavenDB Server
2224
shell: pwsh
2325
run: ./tools/download-ravendb-server.ps1

global.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"sdk": {
3+
"version": "8.0.400",
4+
"rollForward": "latestFeature"
5+
},
6+
"msbuild-sdks": {
7+
"Microsoft.Build.NoTargets": "3.7.56"
8+
}
9+
}

src/Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<PackageVersion Include="System.DirectoryServices.AccountManagement" Version="8.0.1" />
6666
<PackageVersion Include="System.Linq.Async" Version="6.0.1" />
6767
<PackageVersion Include="System.Management" Version="8.0.0" />
68-
<PackageVersion Include="System.Management.Automation" Version="7.2.21" />
68+
<PackageVersion Include="System.Management.Automation" Version="7.4.6" />
6969
<PackageVersion Include="System.Reactive.Linq" Version="6.0.1" />
7070
<PackageVersion Include="System.Reflection.MetadataLoadContext" Version="8.0.1" />
7171
<PackageVersion Include="System.ServiceProcess.ServiceController" Version="8.0.1" />

src/ServiceControl.LicenseManagement/LicenseDetails.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static LicenseDetails TrialFromEndDate(DateOnly endDate)
3333
LicenseType = "Trial",
3434
ExpirationDate = endDate.ToDateTime(TimeOnly.MinValue),
3535
IsExtendedTrial = false,
36-
ValidApplications = new List<string> { "All" }
36+
ValidApplications = ["All"]
3737
});
3838
}
3939

@@ -44,7 +44,7 @@ public static LicenseDetails TrialExpired()
4444
LicenseType = "Trial",
4545
ExpirationDate = DateTime.UtcNow.Date.AddDays(-2), //HasLicenseDateExpired uses a grace period of 1 day
4646
IsExtendedTrial = false,
47-
ValidApplications = new List<string> { "All" }
47+
ValidApplications = ["All"]
4848
});
4949
}
5050

src/ServiceControl.LicenseManagement/ServiceControl.LicenseManagement.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>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>

src/ServiceControl.Management.PowerShell/Particular.ServiceControl.Management.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Copyright = '© 2010-{{Date}} NServiceBus Ltd. All rights reserved'
2525
Description = 'ServiceControl Management'
2626

2727
# Minimum version of the PowerShell engine required by this module
28-
PowerShellVersion = '7.2'
28+
PowerShellVersion = '7.4'
2929

3030
# Name of the PowerShell host required by this module
3131
# PowerShellHostName = ''

src/ServiceControl.Management.PowerShell/ServiceControl.Management.PowerShell.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@
1212
-->
1313

1414
<PropertyGroup>
15-
<!-- Must stay net6.0 to support PowerShell 7.2 LTS -->
16-
<TargetFramework>net6.0-windows</TargetFramework>
15+
<!-- Must stay net8.0 to support PowerShell 7.4 LTS -->
16+
<TargetFramework>net8.0-windows</TargetFramework>
1717

1818
<!--Ensures that all project references are explicitly defined in this file -->
1919
<DisableTransitiveProjectReferences>true</DisableTransitiveProjectReferences>
20-
<LangVersion>12.0</LangVersion>
2120
</PropertyGroup>
2221

2322
<ItemGroup>

src/ServiceControlInstaller.Engine/Accounts/Lsa.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static string[] GetPrivileges(string identity)
2525
// the user has no privileges
2626
if (win32ErrorCode == StatusObjectNameNotFound)
2727
{
28-
return new string[0];
28+
return [];
2929
}
3030

3131
HandleLsaResult(result);

src/ServiceControlInstaller.Engine/Configuration/ServiceControl/UpgradeInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
public class UpgradeInfo
77
{
88
static readonly SemanticVersion[] LastVersionForEachMajor =
9-
{
9+
[
1010
new(1, 48, 0),
1111
new(2, 1, 5),
1212
new(3, 8, 4),
1313
new(4, 33, 0), // Added IngestErrorMessages setting to enable message replay during 4to5 upgrade guide scenario
14-
new(5, 11, 0),
15-
};
14+
new(5, 11, 0)
15+
];
1616

1717
public SemanticVersion[] UpgradePath { get; private init; }
1818
public bool HasIncompatibleVersion { get; private init; }

src/ServiceControlInstaller.Engine/FileSystem/FileUtils.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,7 @@ public static void UnzipToSubdirectory(string zipResourceName, string targetPath
147147

148148
internal static void UnzipToSubdirectory(Stream zipStream, string targetPath)
149149
{
150-
using var zip = new ZipArchive(zipStream, ZipArchiveMode.Read, leaveOpen: false);
151-
zip.ExtractToDirectory(targetPath, overwriteFiles: true);
150+
ZipFile.ExtractToDirectory(zipStream, targetPath, overwriteFiles: true);
152151
}
153152

154153
static void RunWithRetries(Action action)
@@ -165,7 +164,7 @@ static void RunWithRetries(Action action)
165164
{
166165
Debug.WriteLine($"ServiceControlInstaller.Engine.FileSystem.FileUtils::RunWithRetries Action failed, {attempts} attempts remaining. Reason: {ex.Message} ({ex.GetType().FullName})");
167166
// Yes, Task.Delay would be better but would require all calls to be async
168-
// and in 99.9% this sleep will not hit
167+
// and in 99.9% this sleep will not hit
169168
Thread.Sleep(100);
170169
}
171170
}

0 commit comments

Comments
 (0)