From 846ea2063944d88b7c3f223dd097a9fbedb01249 Mon Sep 17 00:00:00 2001 From: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com> Date: Thu, 6 Nov 2025 12:11:02 +0000 Subject: [PATCH 1/2] Add netstandard 2.0 support --- sdks/dotnet/.editorconfig | 26 ++++++++++++++++++++++++++ sdks/dotnet/BinaryInstaller.cs | 22 +++++++++++++--------- sdks/dotnet/TestServerSdk.csproj | 8 +++++++- 3 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 sdks/dotnet/.editorconfig diff --git a/sdks/dotnet/.editorconfig b/sdks/dotnet/.editorconfig new file mode 100644 index 0000000..b86e18c --- /dev/null +++ b/sdks/dotnet/.editorconfig @@ -0,0 +1,26 @@ +[*.cs] +# Rule: Remove unused using directives +# Setting severity to 'suggestion', 'warning', or 'error' will enable the analyzer. +# Code cleanup tools (like in Visual Studio or `dotnet format`) can then remove them. +# 'silent' would still report it for `dotnet format` but not show in IDE as a squiggle. +# 'none' would disable the check entirely. +dotnet_sort_system_directives_first = true +dotnet_separate_import_directive_groups = true +csharp_preferred_using_directive_placement = outside_namespace +indent_size = 2 + +# Suppressed above diagnostics for all .cs files +dotnet_diagnostic.CS8604.severity = none +dotnet_diagnostic.IDE0005.severity = none +dotnet_diagnostic.IDE0011.severity = none +dotnet_diagnostic.IDE1006.severity = none +dotnet_diagnostic.IDE2000.severity = none +dotnet_diagnostic.IDE2002.severity = none +dotnet_diagnostic.CS8600.severity = none +dotnet_diagnostic.CS8602.severity = none +dotnet_diagnostic.IDE0009.severity = none +dotnet_diagnostic.IDE0017.severity = none +dotnet_diagnostic.IDE0028.severity = none +dotnet_diagnostic.CS8603.severity = none +dotnet_diagnostic.CS8424.severity = none +dotnet_diagnostic.CS0108.severity = none \ No newline at end of file diff --git a/sdks/dotnet/BinaryInstaller.cs b/sdks/dotnet/BinaryInstaller.cs index 2ea5fb6..9b42179 100644 --- a/sdks/dotnet/BinaryInstaller.cs +++ b/sdks/dotnet/BinaryInstaller.cs @@ -14,17 +14,13 @@ * limitations under the License. */ -using System; -using System.IO; -using System.Net.Http; -using System.Security.Cryptography; -using System.Text.Json; -using System.Threading.Tasks; -using System.Runtime.InteropServices; -using System.Diagnostics; -using SharpCompress.Readers; using SharpCompress.Common; +using SharpCompress.Readers; +using System.Diagnostics; using System.Reflection; +using System.Runtime.InteropServices; +using System.Security.Cryptography; +using System.Text.Json; namespace TestServerSdk { @@ -154,7 +150,11 @@ private static async Task ComputeSha256Async(string filePath) { using var stream = File.OpenRead(filePath); using var sha = SHA256.Create(); +#if NET6_0_OR_GREATER var hash = await sha.ComputeHashAsync(stream); +#else + var hash = sha.ComputeHash(stream); +#endif return BitConverter.ToString(hash).Replace("-", string.Empty).ToLowerInvariant(); } @@ -163,7 +163,11 @@ private static void ExtractArchive(string archivePath, string archiveExt, string Console.WriteLine($"[TestServerSDK] Extracting {archivePath} to {destDir}..."); if (archiveExt == ".zip") { +#if NET6_0_OR_GREATER System.IO.Compression.ZipFile.ExtractToDirectory(archivePath, destDir, true); +#else + System.IO.Compression.ZipFile.ExtractToDirectory(archivePath, destDir); +#endif } else { diff --git a/sdks/dotnet/TestServerSdk.csproj b/sdks/dotnet/TestServerSdk.csproj index 1c6f6bc..5a6d8c3 100644 --- a/sdks/dotnet/TestServerSdk.csproj +++ b/sdks/dotnet/TestServerSdk.csproj @@ -1,6 +1,6 @@ - net6.0;net8.0 + net6.0;net8.0;netstandard2.0 latest enable enable @@ -20,6 +20,7 @@ + @@ -33,4 +34,9 @@ + + + + + From 1c926363837dd8b4168395210d3e224bc950df55 Mon Sep 17 00:00:00 2001 From: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com> Date: Thu, 6 Nov 2025 12:19:23 +0000 Subject: [PATCH 2/2] Fix double package --- sdks/dotnet/TestServerSdk.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/sdks/dotnet/TestServerSdk.csproj b/sdks/dotnet/TestServerSdk.csproj index 5a6d8c3..5053904 100644 --- a/sdks/dotnet/TestServerSdk.csproj +++ b/sdks/dotnet/TestServerSdk.csproj @@ -20,7 +20,6 @@ -