From 27091e9e1796c954a4865951c25d7a13e2c7b944 Mon Sep 17 00:00:00 2001 From: Yvonne Yu Date: Thu, 4 Dec 2025 18:04:18 -0800 Subject: [PATCH] enable netstandard2.0 --- sdks/dotnet/BinaryInstaller.cs | 12 ++++++++++++ sdks/dotnet/TestServerSdk.csproj | 5 +++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/sdks/dotnet/BinaryInstaller.cs b/sdks/dotnet/BinaryInstaller.cs index 2ea5fb6..40645ab 100644 --- a/sdks/dotnet/BinaryInstaller.cs +++ b/sdks/dotnet/BinaryInstaller.cs @@ -154,7 +154,11 @@ private static async Task ComputeSha256Async(string filePath) { using var stream = File.OpenRead(filePath); using var sha = SHA256.Create(); +#if NETSTANDARD2_0 + var hash = sha.ComputeHash(stream); +#else var hash = await sha.ComputeHashAsync(stream); +#endif return BitConverter.ToString(hash).Replace("-", string.Empty).ToLowerInvariant(); } @@ -163,7 +167,15 @@ private static void ExtractArchive(string archivePath, string archiveExt, string Console.WriteLine($"[TestServerSDK] Extracting {archivePath} to {destDir}..."); if (archiveExt == ".zip") { +#if NETSTANDARD2_0 + if (Directory.Exists(destDir)) + { + Directory.Delete(destDir, true); + } + System.IO.Compression.ZipFile.ExtractToDirectory(archivePath, destDir); +#else System.IO.Compression.ZipFile.ExtractToDirectory(archivePath, destDir, true); +#endif } else { diff --git a/sdks/dotnet/TestServerSdk.csproj b/sdks/dotnet/TestServerSdk.csproj index 1c6f6bc..910460a 100644 --- a/sdks/dotnet/TestServerSdk.csproj +++ b/sdks/dotnet/TestServerSdk.csproj @@ -1,11 +1,11 @@ - net6.0;net8.0 + netstandard2.0;net6.0;net8.0 latest enable enable - 0.1.5 + 0.1.6 Google LLC A .NET SDK to manage the test-server process for integration testing. https://github.com/google/test-server @@ -21,6 +21,7 @@ +