From 3f7b295dccc522499a8550a60980444c6d3b970c Mon Sep 17 00:00:00 2001 From: "Liangying.Wei" Date: Fri, 27 Sep 2024 09:29:52 +0800 Subject: [PATCH] Use net8 reference for AspNet projects (#2049) --- build/dependencies.private.props | 2 -- build/dependencies.props | 13 +++++++++---- src/Directory.Build.props | 11 +++++++++++ .../Microsoft.Azure.SignalR.AspNet.csproj | 6 +----- .../Interfaces/IClientConnectionFactory.cs | 4 ++++ .../Microsoft.Azure.SignalR.Common.csproj | 4 ++-- .../Internal/WebSocketsTransport.cs | 4 ++-- .../Microsoft.Azure.SignalR.AspNet.Tests.csproj | 2 +- 8 files changed, 30 insertions(+), 16 deletions(-) diff --git a/build/dependencies.private.props b/build/dependencies.private.props index 2313d5a43..78c413be1 100644 --- a/build/dependencies.private.props +++ b/build/dependencies.private.props @@ -15,8 +15,6 @@ 4.5.4 2.1.0 2.1.0 - - 1.0.0 2.4.3 8.0.8 diff --git a/build/dependencies.props b/build/dependencies.props index 5441112c1..e394dc50a 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -27,12 +27,17 @@ 4.5.3 - 2.4.1 - 2.1.0 - 4.6.0 - 4.6.0 + 2.4.3 + 8.0.0 + 8.0.0 + 8.0.0 4.2.2 1.0.0 + 8.0.8 + 8.0.0 + 8.0.8 + 8.0.1 + 8.0.8 1.39.0 diff --git a/src/Directory.Build.props b/src/Directory.Build.props index e3b1638eb..d9e24f1ce 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -44,4 +44,15 @@ + + + + + + + + + + + diff --git a/src/Microsoft.Azure.SignalR.AspNet/Microsoft.Azure.SignalR.AspNet.csproj b/src/Microsoft.Azure.SignalR.AspNet/Microsoft.Azure.SignalR.AspNet.csproj index 69185a1ae..932b65eea 100644 --- a/src/Microsoft.Azure.SignalR.AspNet/Microsoft.Azure.SignalR.AspNet.csproj +++ b/src/Microsoft.Azure.SignalR.AspNet/Microsoft.Azure.SignalR.AspNet.csproj @@ -11,11 +11,8 @@ - - - - + @@ -25,7 +22,6 @@ - diff --git a/src/Microsoft.Azure.SignalR.Common/Interfaces/IClientConnectionFactory.cs b/src/Microsoft.Azure.SignalR.Common/Interfaces/IClientConnectionFactory.cs index 5bc4fa24c..1706d243f 100644 --- a/src/Microsoft.Azure.SignalR.Common/Interfaces/IClientConnectionFactory.cs +++ b/src/Microsoft.Azure.SignalR.Common/Interfaces/IClientConnectionFactory.cs @@ -2,7 +2,11 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; +#if NETFRAMEWORK +using System.Web; +#else using Microsoft.AspNetCore.Http; +#endif using Microsoft.Azure.SignalR.Protocol; namespace Microsoft.Azure.SignalR; diff --git a/src/Microsoft.Azure.SignalR.Common/Microsoft.Azure.SignalR.Common.csproj b/src/Microsoft.Azure.SignalR.Common/Microsoft.Azure.SignalR.Common.csproj index 81b9eac09..ce9cebeba 100644 --- a/src/Microsoft.Azure.SignalR.Common/Microsoft.Azure.SignalR.Common.csproj +++ b/src/Microsoft.Azure.SignalR.Common/Microsoft.Azure.SignalR.Common.csproj @@ -6,7 +6,7 @@ - netstandard2.0;net6.0;net8.0 + netstandard2.0;net6.0;net8.0;net462; true @@ -14,7 +14,7 @@ - + diff --git a/src/Microsoft.Azure.SignalR.Common/ServiceConnections/Internal/WebSocketsTransport.cs b/src/Microsoft.Azure.SignalR.Common/ServiceConnections/Internal/WebSocketsTransport.cs index a48b9fc9b..ba03a2eaa 100644 --- a/src/Microsoft.Azure.SignalR.Common/ServiceConnections/Internal/WebSocketsTransport.cs +++ b/src/Microsoft.Azure.SignalR.Common/ServiceConnections/Internal/WebSocketsTransport.cs @@ -201,7 +201,7 @@ private async Task StartReceiving(WebSocket socket) { while (true) { -#if !NETSTANDARD2_0 +#if NETCOREAPP // Do a 0 byte read so that idle connections don't allocate a buffer when waiting for a read var result = await socket.ReceiveAsync(Memory.Empty, CancellationToken.None); @@ -218,7 +218,7 @@ private async Task StartReceiving(WebSocket socket) } #endif var memory = _application.Output.GetMemory(2048); -#if !NETSTANDARD2_0 +#if NETCOREAPP // Because we checked the CloseStatus from the 0 byte read above, we don't need to check again after reading var receiveResult = await socket.ReceiveAsync(memory, CancellationToken.None); #else diff --git a/test/Microsoft.Azure.SignalR.AspNet.Tests/Microsoft.Azure.SignalR.AspNet.Tests.csproj b/test/Microsoft.Azure.SignalR.AspNet.Tests/Microsoft.Azure.SignalR.AspNet.Tests.csproj index e2944863b..353c78ad9 100644 --- a/test/Microsoft.Azure.SignalR.AspNet.Tests/Microsoft.Azure.SignalR.AspNet.Tests.csproj +++ b/test/Microsoft.Azure.SignalR.AspNet.Tests/Microsoft.Azure.SignalR.AspNet.Tests.csproj @@ -19,7 +19,7 @@ - +