Skip to content

Commit

Permalink
Use net8 reference for AspNet projects (#2049)
Browse files Browse the repository at this point in the history
  • Loading branch information
vicancy authored Sep 27, 2024
1 parent 9f17c81 commit 3f7b295
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 16 deletions.
2 changes: 0 additions & 2 deletions build/dependencies.private.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
<SystemThreadingTasksExtensionsVersion>4.5.4</SystemThreadingTasksExtensionsVersion>
<MicrosoftExtensionsLoggingTestingPackageVersion>2.1.0</MicrosoftExtensionsLoggingTestingPackageVersion>
<MicrosoftAspNetCoreTestingVersion>2.1.0</MicrosoftAspNetCoreTestingVersion>
<!--Requires old version due to the breaking change in https://github.com/Azure/azure-signalr/issues/1503-->
<MicrosoftAspNetCoreHttpConnectionsClientPackageOldVersion>1.0.0</MicrosoftAspNetCoreHttpConnectionsClientPackageOldVersion>
<MicrosoftAspNetSignalRClientVersion>2.4.3</MicrosoftAspNetSignalRClientVersion>

<MicrosoftAspNetCoreSignalRClientPackageVersion>8.0.8</MicrosoftAspNetCoreSignalRClientPackageVersion>
Expand Down
13 changes: 9 additions & 4 deletions build/dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@
<SystemNetWebSocketsWebSocketProtocolPackageVersion>4.5.3</SystemNetWebSocketsWebSocketProtocolPackageVersion>

<!-- Azure ASP.NET SignalR -->
<MicrosoftAspNetSignalRPackageVersion>2.4.1</MicrosoftAspNetSignalRPackageVersion>
<MicrosoftExtensionsLoggingEventSourcePackageVersion>2.1.0</MicrosoftExtensionsLoggingEventSourcePackageVersion>
<SystemThreadingChannelsPackageVersion>4.6.0</SystemThreadingChannelsPackageVersion>
<SystemIOPipelinesPackageVersion>4.6.0</SystemIOPipelinesPackageVersion>
<MicrosoftAspNetSignalRPackageVersion>2.4.3</MicrosoftAspNetSignalRPackageVersion>
<MicrosoftExtensionsLoggingEventSourcePackageVersion>8.0.0</MicrosoftExtensionsLoggingEventSourcePackageVersion>
<SystemThreadingChannelsPackageVersion>8.0.0</SystemThreadingChannelsPackageVersion>
<SystemIOPipelinesPackageVersion>8.0.0</SystemIOPipelinesPackageVersion>
<MicrosoftOwinPackageVersion>4.2.2</MicrosoftOwinPackageVersion>
<OwinPackageVersion>1.0.0</OwinPackageVersion>
<MicrosoftAspNetCoreConnectionsAbstractionsNet8PackageVersion>8.0.8</MicrosoftAspNetCoreConnectionsAbstractionsNet8PackageVersion>
<MicrosoftExtensionsDependencyInjectionNet8PackageVersion>8.0.0</MicrosoftExtensionsDependencyInjectionNet8PackageVersion>
<MicrosoftAspNetCoreHttpConnectionsCommonNet8PackageVersion>8.0.8</MicrosoftAspNetCoreHttpConnectionsCommonNet8PackageVersion>
<MicrosoftExtensionsLoggingAbstractionsNet8PackageVersion>8.0.1</MicrosoftExtensionsLoggingAbstractionsNet8PackageVersion>
<MicrosoftAspNetCoreSignalRCommonNet8PackageVersion>8.0.8</MicrosoftAspNetCoreSignalRCommonNet8PackageVersion>

<!-- SignalR Management -->
<AzureCorePackageVersion>1.39.0</AzureCorePackageVersion>
Expand Down
11 changes: 11 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,15 @@
<PackageReference Include="System.Net.WebSockets.WebSocketProtocol" Version="$(SystemNetWebSocketsWebSocketProtocolPackageVersion)" />
</ItemGroup>

<!-- For AspNet SignalR only-->
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="$(MicrosoftExtensionsDependencyInjectionNet8PackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Connections.Abstractions" Version="$(MicrosoftAspNetCoreConnectionsAbstractionsNet8PackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Http.Connections.Common" Version="$(MicrosoftAspNetCoreHttpConnectionsCommonNet8PackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsLoggingAbstractionsNet8PackageVersion)" />
<PackageReference Include="System.IO.Pipelines" Version="$(SystemIOPipelinesPackageVersion)" />
<PackageReference Include="System.Threading.Channels" Version="$(SystemThreadingChannelsPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="$(MicrosoftAspNetCoreSignalRCommonNet8PackageVersion)" />
<Reference Include="System.Web" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@
<!-- Directly reference Microsoft.Owin 4.x for security fix -->
<PackageReference Include="Microsoft.Owin" Version="$(MicrosoftOwinPackageVersion)" />
<PackageReference Include="Microsoft.AspNet.SignalR" Version="$(MicrosoftAspNetSignalRPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Connections.Abstractions" Version="$(MicrosoftAspNetCoreConnectionsAbstractionsPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="$(MicrosoftExtensionsDependencyInjectionPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.EventSource" Version="$(MicrosoftExtensionsLoggingEventSourcePackageVersion)" />
<PackageReference Include="System.IO.Pipelines" Version="$(SystemIOPipelinesPackageVersion)" />
<PackageReference Include="System.Threading.Channels" Version="$(SystemThreadingChannelsPackageVersion)" />

</ItemGroup>

<ItemGroup>
Expand All @@ -25,7 +22,6 @@

<ItemGroup>
<Reference Include="System.Configuration" />
<Reference Include="System.Web" />
</ItemGroup>

<!-- Copy the referenced Microsoft.Azure.SignalR.Common.dll into the package https://github.com/nuget/home/issues/3891#issuecomment-397481361 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
</PropertyGroup>

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net8.0;net462;</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Microsoft.Azure.SignalR.Protocols\Microsoft.Azure.SignalR.Protocols.csproj" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' != '.NETStandard' ">
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' != '.NETStandard' and '$(TargetFrameworkIdentifier)' != '.NETFramework'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<byte>.Empty, CancellationToken.None);

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<PackageReference Include="Microsoft.Owin.Testing" Version="$(MicrosoftOwinTestingPackageVersion)" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="$(SystemIdentityModelTokensJwtPackageVersion)" />
<PackageReference Include="Microsoft.Owin.Host.HttpListener" Version="$(MicrosoftOwinTestingPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Http.Connections.Client" Version="$(MicrosoftAspNetCoreHttpConnectionsClientPackageOldVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Http.Connections.Client" Version="$(MicrosoftAspNetCoreHttpConnectionsClientPackageVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 3f7b295

Please sign in to comment.