From 02e65bca67e460888336bcba9aa8462f20def2c3 Mon Sep 17 00:00:00 2001 From: JanEggers Date: Wed, 16 Dec 2020 14:41:54 +0100 Subject: [PATCH] fixed .net 5 build --- Source/MQTTnet.AspnetCore/Client/Tcp/TcpConnection.cs | 4 ++-- .../Extensions/ConnectionRouteBuilderExtensions.cs | 2 ++ .../MQTTnet.AspnetCore/Extensions/EndpointRouterExtensions.cs | 2 +- Source/MQTTnet.AspnetCore/MQTTnet.AspNetCore.csproj | 4 ++-- Tests/MQTTnet.TestApp.AspNetCore2/Startup.cs | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Source/MQTTnet.AspnetCore/Client/Tcp/TcpConnection.cs b/Source/MQTTnet.AspnetCore/Client/Tcp/TcpConnection.cs index 0dbe161..7814567 100644 --- a/Source/MQTTnet.AspnetCore/Client/Tcp/TcpConnection.cs +++ b/Source/MQTTnet.AspnetCore/Client/Tcp/TcpConnection.cs @@ -40,7 +40,7 @@ namespace MQTTnet.AspNetCore.Client.Tcp _sender = new SocketSender(_socket, PipeScheduler.ThreadPool); _receiver = new SocketReceiver(_socket, PipeScheduler.ThreadPool); } -#if NETCOREAPP3_1 +#if NETCOREAPP3_1 || NET5_0 public override ValueTask DisposeAsync() #else public Task DisposeAsync() @@ -53,7 +53,7 @@ namespace MQTTnet.AspNetCore.Client.Tcp _socket?.Dispose(); -#if NETCOREAPP3_1 +#if NETCOREAPP3_1 || NET5_0 return base.DisposeAsync(); } diff --git a/Source/MQTTnet.AspnetCore/Extensions/ConnectionRouteBuilderExtensions.cs b/Source/MQTTnet.AspnetCore/Extensions/ConnectionRouteBuilderExtensions.cs index 2736fce..0595b98 100644 --- a/Source/MQTTnet.AspnetCore/Extensions/ConnectionRouteBuilderExtensions.cs +++ b/Source/MQTTnet.AspnetCore/Extensions/ConnectionRouteBuilderExtensions.cs @@ -12,6 +12,7 @@ namespace MQTTnet.AspNetCore.Extensions #if NETCOREAPP3_1 [Obsolete("This class is obsolete and will be removed in a future version. The recommended alternative is to use MapMqtt inside Microsoft.AspNetCore.Builder.UseEndpoints(...).")] #endif +#if NETCOREAPP3_1 || NETCOREAPP2_1 || NETSTANDARD public static void MapMqtt(this ConnectionsRouteBuilder connection, PathString path) { connection.MapConnectionHandler(path, options => @@ -19,5 +20,6 @@ namespace MQTTnet.AspNetCore.Extensions options.WebSockets.SubProtocolSelector = MqttSubProtocolSelector.SelectSubProtocol; }); } +#endif } } diff --git a/Source/MQTTnet.AspnetCore/Extensions/EndpointRouterExtensions.cs b/Source/MQTTnet.AspnetCore/Extensions/EndpointRouterExtensions.cs index d2a2805..7cbed8c 100644 --- a/Source/MQTTnet.AspnetCore/Extensions/EndpointRouterExtensions.cs +++ b/Source/MQTTnet.AspnetCore/Extensions/EndpointRouterExtensions.cs @@ -1,5 +1,5 @@  -#if NETCOREAPP3_1 +#if NETCOREAPP3_1 || NET5_0 using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Routing; diff --git a/Source/MQTTnet.AspnetCore/MQTTnet.AspNetCore.csproj b/Source/MQTTnet.AspnetCore/MQTTnet.AspNetCore.csproj index 27294d4..f2a891d 100644 --- a/Source/MQTTnet.AspnetCore/MQTTnet.AspNetCore.csproj +++ b/Source/MQTTnet.AspnetCore/MQTTnet.AspNetCore.csproj @@ -21,11 +21,11 @@ RELEASE;NETSTANDARD2_0 - + - + diff --git a/Tests/MQTTnet.TestApp.AspNetCore2/Startup.cs b/Tests/MQTTnet.TestApp.AspNetCore2/Startup.cs index 9a240f5..6eb8bfb 100644 --- a/Tests/MQTTnet.TestApp.AspNetCore2/Startup.cs +++ b/Tests/MQTTnet.TestApp.AspNetCore2/Startup.cs @@ -27,7 +27,7 @@ namespace MQTTnet.TestApp.AspNetCore2 } // In class _Startup_ of the ASP.NET Core 3.1 project. -#if NETCOREAPP3_1 +#if NETCOREAPP3_1 || NET5_0 public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseRouting();