Skip to content

Commit d2c33ab

Browse files
committed
Added .NET Framework 471 as a target. .NET 5 is out
1 parent e968fa8 commit d2c33ab

File tree

13 files changed

+26
-15
lines changed

13 files changed

+26
-15
lines changed

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'RestSharp.sln'))\props\Common.props"/>
33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;net5.0;net6.0</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.0;net471;net6.0;net7.0</TargetFrameworks>
55
<PackageIcon>restsharp.png</PackageIcon>
66
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
77
<PackageProjectUrl>https://restsharp.dev</PackageProjectUrl>

src/RestSharp.Serializers.CsvHelper/RestSharp.Serializers.CsvHelper.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@
55
<ItemGroup>
66
<ProjectReference Include="..\RestSharp\RestSharp.csproj"/>
77
</ItemGroup>
8+
<ItemGroup>
9+
<Using Remove="System.Net.Http"/>
10+
</ItemGroup>
811
</Project>

src/RestSharp.Serializers.NewtonsoftJson/RestSharp.Serializers.NewtonsoftJson.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
</ItemGroup>
88
<ItemGroup>
99
<Using Include="Newtonsoft.Json"/>
10+
<Using Remove="System.Net.Http"/>
1011
</ItemGroup>
1112
</Project>

src/RestSharp.Serializers.Xml/RestSharp.Serializers.Xml.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@
55
<ItemGroup>
66
<ProjectReference Include="..\RestSharp\RestSharp.csproj"/>
77
</ItemGroup>
8+
<ItemGroup>
9+
<Using Remove="System.Net.Http"/>
10+
</ItemGroup>
811
</Project>

src/RestSharp/Authenticators/OAuth/OAuth1Authenticator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ string GetAuthorizationHeader() {
263263
if (!Realm.IsEmpty())
264264
oathParameters.Insert(0, $"realm=\"{OAuthTools.UrlEncodeRelaxed(Realm!)}\"");
265265

266-
return "OAuth " + string.Join(",", oathParameters);
266+
return $"OAuth {string.Join(",", oathParameters)}";
267267
}
268268
}
269269
}

src/RestSharp/Extensions/StreamExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static async Task<byte[]> ReadAsBytes(this Stream input, CancellationToke
3030
using var ms = new MemoryStream();
3131

3232
int read;
33-
#if NETSTANDARD
33+
#if NETSTANDARD || NETFRAMEWORK
3434
while ((read = await input.ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false)) > 0)
3535
#else
3636
while ((read = await input.ReadAsync(buffer, cancellationToken).ConfigureAwait(false)) > 0)

src/RestSharp/Properties/IsExternalInit.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if NETSTANDARD
1+
#if NETSTANDARD || NETFRAMEWORK
22
using System.ComponentModel;
33

44
// ReSharper disable once CheckNamespace

src/RestSharp/Response/ResponseHandling.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Encoding TryGetEncoding(string es) {
3636
}
3737

3838
public static Task<Stream?> ReadResponse(this HttpResponseMessage response, CancellationToken cancellationToken) {
39-
#if NETSTANDARD
39+
#if NETSTANDARD || NETFRAMEWORK
4040
return response.Content.ReadAsStreamAsync();
4141
# else
4242
return response.Content.ReadAsStreamAsync(cancellationToken)!;

src/RestSharp/Response/RestResponse.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static RestResponse<T> FromResponse(RestResponse response)
5858
/// <summary>
5959
/// Container for data sent back from API
6060
/// </summary>
61-
[DebuggerDisplay("{" + nameof(DebuggerDisplay) + "()}")]
61+
[DebuggerDisplay($"{{{nameof(DebuggerDisplay)}()}}")]
6262
public class RestResponse : RestResponseBase {
6363
internal static async Task<RestResponse> FromHttpResponse(
6464
HttpResponseMessage httpResponse,
@@ -72,7 +72,7 @@ CancellationToken cancellationToken
7272

7373
async Task<RestResponse> GetDefaultResponse() {
7474
var readTask = request.ResponseWriter == null ? ReadResponse() : ReadAndConvertResponse();
75-
#if NETSTANDARD
75+
#if NETSTANDARD || NETFRAMEWORK
7676
using var stream = await readTask.ConfigureAwait(false);
7777
#else
7878
await using var stream = await readTask.ConfigureAwait(false);
@@ -105,7 +105,7 @@ async Task<RestResponse> GetDefaultResponse() {
105105
Exception? MaybeException()
106106
=> httpResponse.IsSuccessStatusCode
107107
? null
108-
#if NETSTANDARD
108+
#if NETSTANDARD || NETFRAMEWORK
109109
: new HttpRequestException($"Request failed with status code {httpResponse.StatusCode}");
110110
#else
111111
: new HttpRequestException($"Request failed with status code {httpResponse.StatusCode}", null, httpResponse.StatusCode);
@@ -114,7 +114,7 @@ async Task<RestResponse> GetDefaultResponse() {
114114
Task<Stream?> ReadResponse() => httpResponse.ReadResponse(cancellationToken);
115115

116116
async Task<Stream?> ReadAndConvertResponse() {
117-
#if NETSTANDARD
117+
#if NETSTANDARD || NETFRAMEWORK
118118
using var original = await ReadResponse().ConfigureAwait(false);
119119
#else
120120
await using var original = await ReadResponse().ConfigureAwait(false);

src/RestSharp/RestClient.Async.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ record InternalResponse(HttpResponseMessage? ResponseMessage, Uri Url, Exception
106106
if (response.ResponseMessage == null) return null;
107107

108108
if (request.ResponseWriter != null) {
109-
#if NETSTANDARD
109+
#if NETSTANDARD || NETFRAMEWORK
110110
using var stream = await response.ResponseMessage.ReadResponse(cancellationToken).ConfigureAwait(false);
111111
#else
112112
await using var stream = await response.ResponseMessage.ReadResponse(cancellationToken).ConfigureAwait(false);
@@ -138,7 +138,7 @@ static HttpMethod AsHttpMethod(Method method)
138138
Method.Delete => HttpMethod.Delete,
139139
Method.Head => HttpMethod.Head,
140140
Method.Options => HttpMethod.Options,
141-
#if NETSTANDARD
141+
#if NETSTANDARD || NETFRAMEWORK
142142
Method.Patch => new HttpMethod("PATCH"),
143143
#else
144144
Method.Patch => HttpMethod.Patch,

0 commit comments

Comments
 (0)