Skip to content

Commit 69391ec

Browse files
authored
enable netstandard2.0 (#60)
1 parent c41cf3c commit 69391ec

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

sdks/dotnet/BinaryInstaller.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,11 @@ private static async Task<string> ComputeSha256Async(string filePath)
154154
{
155155
using var stream = File.OpenRead(filePath);
156156
using var sha = SHA256.Create();
157+
#if NETSTANDARD2_0
158+
var hash = sha.ComputeHash(stream);
159+
#else
157160
var hash = await sha.ComputeHashAsync(stream);
161+
#endif
158162
return BitConverter.ToString(hash).Replace("-", string.Empty).ToLowerInvariant();
159163
}
160164

@@ -163,7 +167,15 @@ private static void ExtractArchive(string archivePath, string archiveExt, string
163167
Console.WriteLine($"[TestServerSDK] Extracting {archivePath} to {destDir}...");
164168
if (archiveExt == ".zip")
165169
{
170+
#if NETSTANDARD2_0
171+
if (Directory.Exists(destDir))
172+
{
173+
Directory.Delete(destDir, true);
174+
}
175+
System.IO.Compression.ZipFile.ExtractToDirectory(archivePath, destDir);
176+
#else
166177
System.IO.Compression.ZipFile.ExtractToDirectory(archivePath, destDir, true);
178+
#endif
167179
}
168180
else
169181
{

sdks/dotnet/TestServerSdk.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
3+
<TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
44
<LangVersion>latest</LangVersion>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77

8-
<PackageVersion>0.1.5</PackageVersion>
8+
<PackageVersion>0.1.6</PackageVersion>
99
<Authors>Google LLC</Authors>
1010
<Description>A .NET SDK to manage the test-server process for integration testing.</Description>
1111
<PackageProjectUrl>https://github.com/google/test-server</PackageProjectUrl>
@@ -21,6 +21,7 @@
2121
<ItemGroup>
2222
<PackageReference Include="YamlDotNet" Version="12.0.2" />
2323
<PackageReference Include="SharpCompress" Version="0.29.0" />
24+
<PackageReference Include="System.Text.Json" Version="10.0.0" />
2425
</ItemGroup>
2526
<ItemGroup>
2627
<!-- ADD this to embed the file directly into the DLL -->

0 commit comments

Comments
 (0)