feat: Add .NET Standard 2.0 target

This commit is contained in:
Valters Melnalksnis
2022-11-09 21:57:31 +02:00
parent 19440e6d3b
commit 43764cc3f3
13 changed files with 76 additions and 37 deletions
@@ -40,7 +40,11 @@ public static class ServiceCollectionExtensions
/// <param name="serviceCollection">The service collection in which to register the services.</param>
/// <param name="configuration">The configuration to which to bind options models.</param>
/// <returns>The <see cref="IHttpClientBuilder"/> for the <see cref="HttpClient"/> used by <see cref="INordigenClient"/>.</returns>
#if NET6_0_OR_GREATER
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026", Justification = $"{nameof(NordigenOptions)} contains only system types.")]
#else
[SuppressMessage("Trimming", "IL2026", Justification = $"{nameof(NordigenOptions)} contains only system types.")]
#endif
public static IHttpClientBuilder AddNordigenDotNet(
this IServiceCollection serviceCollection,
IConfiguration configuration)
@@ -1,8 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Product>VMelnalksnis.NordigenDotNet.DependencyInjection</Product>
<ProductId>VMelnalksnis.NordigenDotNet.DependencyInjection</ProductId>
<Description>Dependency injection configuration for VMelnalksnis.NordigenDotNet</Description>
@@ -17,6 +17,10 @@ internal static class HttpResponseMessageExtensions
}
var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
#if NET6_0_OR_GREATER
throw new HttpRequestException(content, null, response.StatusCode);
#else
throw new HttpRequestException(content);
#endif
}
}
@@ -1,8 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Product>VMelnalksnis.NordigenDotNet</Product>
<ProductId>VMelnalksnis.NordigenDotNet</ProductId>
<Description>.NET API client for Nordigen</Description>
@@ -20,6 +18,12 @@
<PackageReference Include="NodaTime.Serialization.SystemTextJson" Version="1.0.0"/>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0"/>
<PackageReference Include="System.Net.Http.Json" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\README.md" Pack="true" PackagePath="\"/>
</ItemGroup>