Skip to content

Commit 5c6daec

Browse files
committed
Add support for .NET 6 TFM builds + switch to net6.0 tests
1 parent 1b814e1 commit 5c6daec

File tree

314 files changed

+604
-486
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

314 files changed

+604
-486
lines changed

src/Directory.Build.props

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<Version>5.12.1</Version>
55
<Authors>ServiceStack</Authors>
66
<Company>ServiceStack, Inc.</Company>
7-
<Copyright>&#169; 2008-2019 ServiceStack, Inc</Copyright>
7+
<Copyright>&#169; 2008-2022 ServiceStack, Inc</Copyright>
88
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
99
<PackageProjectUrl>https://github.com/ServiceStack/ServiceStack</PackageProjectUrl>
1010
<PackageLicenseUrl>https://servicestack.net/terms</PackageLicenseUrl>
@@ -43,12 +43,12 @@
4343
<DefineConstants>$(DefineConstants);NETSTANDARD;NETSTANDARD2_1</DefineConstants>
4444
</PropertyGroup>
4545

46-
<PropertyGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
47-
<DefineConstants>$(DefineConstants);NET50</DefineConstants>
46+
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
47+
<DefineConstants>$(DefineConstants);NET6_0;NET6_0_OR_GREATER</DefineConstants>
4848
</PropertyGroup>
4949

50-
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'netstandard2.1' OR '$(TargetFramework)' == 'netcoreapp3.1' OR '$(TargetFramework)' == 'net5.0' ">
51-
<DefineConstants>$(DefineConstants);NETCORE_SUPPORT;NETCORE</DefineConstants>
50+
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'netstandard2.1' OR '$(TargetFramework)' == 'netcoreapp3.1' OR '$(TargetFramework)' == 'net5.0' OR '$(TargetFramework)' == 'net6.0' ">
51+
<DefineConstants>$(DefineConstants);NETCORE;NETCORE_SUPPORT</DefineConstants>
5252
</PropertyGroup>
5353

5454
<ItemGroup>

src/ServiceStack.Api.OpenApi/ServiceStack.Api.OpenApi.csproj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<PackageId>ServiceStack.Api.OpenApi</PackageId>
55
<AssemblyName>ServiceStack.Api.OpenApi</AssemblyName>
6-
<TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
6+
<TargetFrameworks>net45;netstandard2.0;net6.0</TargetFrameworks>
77
<Title>ServiceStack support for Open API v2.0 and integrated Swagger UI</Title>
88
<PackageDescription>
99
Implements v2.0 of the Open API Specification (https://www.openapis.org).
@@ -35,4 +35,10 @@
3535
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
3636
</ItemGroup>
3737

38+
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
39+
<PackageReference Include="System.ServiceModel.Primitives" Version="4.8.1" />
40+
<PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
41+
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
42+
</ItemGroup>
43+
3844
</Project>

src/ServiceStack.Client/CryptUtils.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ public static class PlatformRsaUtils
395395
{
396396
public static void FromXml(this RSA rsa, string xml)
397397
{
398-
#if !NETSTANDARD2_0
398+
#if !NETCORE
399399
rsa.FromXmlString(xml);
400400
#else
401401
//Throws PlatformNotSupportedException
@@ -406,15 +406,15 @@ public static void FromXml(this RSA rsa, string xml)
406406

407407
public static string ToXml(this RSA rsa, bool includePrivateParameters)
408408
{
409-
#if !NETSTANDARD2_0
409+
#if !NETCORE
410410
return rsa.ToXmlString(includePrivateParameters: includePrivateParameters);
411411
#else
412412
//Throws PlatformNotSupportedException
413413
return ExportToXml(rsa.ExportParameters(includePrivateParameters), includePrivateParameters);
414414
#endif
415415
}
416416

417-
#if NETSTANDARD2_0
417+
#if NETCORE
418418
public static HashAlgorithmName ToHashAlgorithmName(string hashAlgorithm)
419419
{
420420
return hashAlgorithm.ToUpper() switch {
@@ -430,7 +430,7 @@ public static HashAlgorithmName ToHashAlgorithmName(string hashAlgorithm)
430430

431431
public static byte[] Encrypt(this RSA rsa, byte[] bytes)
432432
{
433-
#if !NETSTANDARD2_0
433+
#if !NETCORE
434434
return ((RSACryptoServiceProvider)rsa).Encrypt(bytes, RsaUtils.DoOAEPPadding);
435435
#else
436436
return rsa.Encrypt(bytes, RSAEncryptionPadding.OaepSHA1);
@@ -439,7 +439,7 @@ public static byte[] Encrypt(this RSA rsa, byte[] bytes)
439439

440440
public static byte[] Decrypt(this RSA rsa, byte[] bytes)
441441
{
442-
#if !NETSTANDARD2_0
442+
#if !NETCORE
443443
return ((RSACryptoServiceProvider)rsa).Decrypt(bytes, RsaUtils.DoOAEPPadding);
444444
#else
445445
return rsa.Decrypt(bytes, RSAEncryptionPadding.OaepSHA1);
@@ -448,7 +448,7 @@ public static byte[] Decrypt(this RSA rsa, byte[] bytes)
448448

449449
public static byte[] SignData(this RSA rsa, byte[] bytes, string hashAlgorithm)
450450
{
451-
#if !NETSTANDARD2_0
451+
#if !NETCORE
452452
return ((RSACryptoServiceProvider)rsa).SignData(bytes, hashAlgorithm);
453453
#else
454454
return rsa.SignData(bytes, ToHashAlgorithmName(hashAlgorithm), RSASignaturePadding.Pkcs1);
@@ -457,7 +457,7 @@ public static byte[] SignData(this RSA rsa, byte[] bytes, string hashAlgorithm)
457457

458458
public static bool VerifyData(this RSA rsa, byte[] bytes, byte[] signature, string hashAlgorithm)
459459
{
460-
#if !NETSTANDARD2_0
460+
#if !NETCORE
461461
return ((RSACryptoServiceProvider)rsa).VerifyData(bytes, hashAlgorithm, signature);
462462
#else
463463
return rsa.VerifyData(bytes, signature, ToHashAlgorithmName(hashAlgorithm), RSASignaturePadding.Pkcs1);

src/ServiceStack.Client/Pcl.NameValueCollectionWrapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
using System.Collections.Specialized;
4040

41-
#if NETSTANDARD2_0
41+
#if NETCORE
4242
//namespace System.Collections.Specialized
4343
namespace ServiceStack.Pcl
4444
{

src/ServiceStack.Client/PclExportClient.NetStandard.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//Copyright (c) ServiceStack, Inc. All Rights Reserved.
22
//License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt
33

4-
#if NETSTANDARD2_0
4+
#if NETCORE
55
using System;
66
using System.Collections.Specialized;
77
using System.IO;
@@ -75,7 +75,7 @@ public override void SetIfModifiedSince(HttpWebRequest webReq, DateTime lastModi
7575
}
7676
else
7777
{
78-
#if NETSTANDARD2_0
78+
#if NETCORE
7979
if (lastModified == DateTime.MinValue)
8080
webReq.Headers.Remove(HttpHeaders.IfModifiedSince);
8181
else
@@ -136,7 +136,6 @@ private static string[] GetValues(WebHeaderCollection headers, string header)
136136
}
137137
}
138138

139-
#if !NETSTANDARD1_1
140139
public class AsyncTimer : ITimer
141140
{
142141
public System.Threading.Timer Timer;
@@ -162,6 +161,5 @@ public void Dispose()
162161
this.Timer = null;
163162
}
164163
}
165-
#endif
166164
}
167165
#endif

src/ServiceStack.Client/PclExportClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace ServiceStack
5555
public class PclExportClient
5656
{
5757
public static PclExportClient Instance
58-
#if NETSTANDARD2_0
58+
#if NETCORE
5959
= NetStandardPclExportClient.Configure()
6060
#else
6161
= Net45PclExportClient.Configure()
@@ -103,7 +103,7 @@ public static bool ConfigureProvider(string typeName)
103103

104104
public virtual NameValueCollection ParseQueryString(string query)
105105
{
106-
#if NETSTANDARD2_0
106+
#if NETCORE
107107
return ServiceStack.Pcl.HttpUtility.ParseQueryString(query);
108108
#else
109109
return System.Web.HttpUtility.ParseQueryString(query);
@@ -122,7 +122,7 @@ public virtual string UrlDecode(string url)
122122

123123
public virtual string HtmlAttributeEncode(string html)
124124
{
125-
#if NETSTANDARD2_0
125+
#if NETCORE
126126
return HtmlEncode(html).Replace("\"","&quot;").Replace("'","&#x27;");
127127
#else
128128
return System.Web.HttpUtility.HtmlAttributeEncode(html);

src/ServiceStack.Client/ServerEventsClient.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,8 @@ protected void StartNewHeartbeat()
299299

300300
heartbeatTimer?.Cancel();
301301

302-
#if !NETSTANDARD1_1
303302
heartbeatTimer = PclExportClient.Instance.CreateTimer(Heartbeat,
304303
TimeSpan.FromMilliseconds(ConnectionInfo.HeartbeatIntervalMs), this);
305-
#endif
306304
}
307305

308306
protected void Heartbeat(object state)

src/ServiceStack.Client/ServiceClientBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1983,7 +1983,7 @@ public static partial class ServiceClientExtensions
19831983
{
19841984
public static Stream ResponseStream(this WebResponse webRes)
19851985
{
1986-
#if NETSTANDARD2_0
1986+
#if NETCORE
19871987
return webRes.GetResponseStream().Decompress(webRes.Headers[HttpHeaders.ContentEncoding]);
19881988
#else
19891989
return webRes.GetResponseStream();

src/ServiceStack.Client/ServiceStack.Client.csproj

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@
33
<PropertyGroup>
44
<PackageId>ServiceStack.Client</PackageId>
55
<AssemblyName>ServiceStack.Client</AssemblyName>
6-
<TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
6+
<TargetFrameworks>net45;netstandard2.0;net6.0</TargetFrameworks>
77
<Title>.NET and .NET Core fast, end-to-end typed, code-gen free Service Clients</Title>
88
<PackageDescription>JSON, XML, CSV, JSV, SOAP and MQ Generic Service Clients.</PackageDescription>
99
<PackageTags>ServiceStack;Common;Framework;Clients;ServiceClients;Gateway</PackageTags>
1010
</PropertyGroup>
11+
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
12+
<DefineConstants>$(DefineConstants);NETCORE;NETSTANDARD2_0</DefineConstants>
13+
</PropertyGroup>
14+
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
15+
<DefineConstants>$(DefineConstants);NETSTANDARD;NET6_0</DefineConstants>
16+
</PropertyGroup>
1117

1218
<ItemGroup>
1319
<ProjectReference Include="..\ServiceStack.Interfaces\ServiceStack.Interfaces.csproj" />
@@ -27,4 +33,12 @@
2733
<PackageReference Include="System.Collections.Specialized" Version="4.3.0" />
2834
</ItemGroup>
2935

36+
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
37+
<PackageReference Include="System.Memory" Version="4.5.4" />
38+
<PackageReference Include="System.Net.Requests" Version="4.3.0" />
39+
<PackageReference Include="System.ServiceModel.Primitives" Version="4.8.1" />
40+
<PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
41+
<PackageReference Include="System.Collections.Specialized" Version="4.3.0" />
42+
</ItemGroup>
43+
3044
</Project>

src/ServiceStack.Client/WebRequestUtils.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ internal static void AddDigestAuth(this WebRequest client, string userName, stri
240240

241241
public static string GetResponseDtoName(Type requestType)
242242
{
243-
#if NETSTANDARD2_0
243+
#if NETCORE
244244
return requestType.FullName + ResponseDtoSuffix + "," + requestType.Assembly.GetName().Name;
245245
#else
246246
return requestType.FullName + ResponseDtoSuffix;
@@ -271,7 +271,7 @@ public static Type GetErrorResponseDtoType(Type requestType)
271271
return typeof (ErrorResponse);
272272

273273
//If a conventionally-named Response type exists use that regardless if it has ResponseStatus or not
274-
#if NETSTANDARD2_0
274+
#if NETCORE
275275
var responseDtoType = Type.GetType(GetResponseDtoName(requestType));
276276
#else
277277
var responseDtoType = AssemblyUtils.FindType(GetResponseDtoName(requestType));

0 commit comments

Comments
 (0)