diff --git a/BTCPayServer.Common/BTCPayServer.Common.csproj b/BTCPayServer.Common/BTCPayServer.Common.csproj index 56db03260..a2a325513 100644 --- a/BTCPayServer.Common/BTCPayServer.Common.csproj +++ b/BTCPayServer.Common/BTCPayServer.Common.csproj @@ -3,8 +3,7 @@ - - + diff --git a/BTCPayServer.Common/Shims.cs b/BTCPayServer.Common/Shims.cs index e5966b6ff..4ceed0d3d 100644 --- a/BTCPayServer.Common/Shims.cs +++ b/BTCPayServer.Common/Shims.cs @@ -1,4 +1,3 @@ -#if !NETCOREAPP21 // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. @@ -235,25 +234,3 @@ namespace Microsoft.Extensions.Logging.Abstractions.Internal } } } - - -#else -using Microsoft.Extensions.Options; -using Newtonsoft.Json; - -namespace Microsoft.AspNetCore.Mvc -{ - /// - /// Provides programmatic configuration for JSON formatters using Newtonsoft.JSON. - /// - public class MvcNewtonsoftJsonOptions - { - IOptions jsonOptions; - public MvcNewtonsoftJsonOptions(IOptions jsonOptions) - { - this.jsonOptions = jsonOptions; - } - public JsonSerializerSettings SerializerSettings => this.jsonOptions.Value.SerializerSettings; - } -} -#endif diff --git a/BTCPayServer.Data/BTCPayServer.Data.csproj b/BTCPayServer.Data/BTCPayServer.Data.csproj index ba80cab0d..e25b7789b 100644 --- a/BTCPayServer.Data/BTCPayServer.Data.csproj +++ b/BTCPayServer.Data/BTCPayServer.Data.csproj @@ -1,14 +1,7 @@  - - - - - - - - + diff --git a/BTCPayServer.Data/Data/ApplicationDbContextFactory.cs b/BTCPayServer.Data/Data/ApplicationDbContextFactory.cs index 25093fc9b..51e8b954d 100644 --- a/BTCPayServer.Data/Data/ApplicationDbContextFactory.cs +++ b/BTCPayServer.Data/Data/ApplicationDbContextFactory.cs @@ -45,11 +45,7 @@ namespace BTCPayServer.Data class CustomNpgsqlMigrationsSqlGenerator : NpgsqlMigrationsSqlGenerator { -#if NETCOREAPP21 - public CustomNpgsqlMigrationsSqlGenerator(MigrationsSqlGeneratorDependencies dependencies) : base(dependencies) -#else public CustomNpgsqlMigrationsSqlGenerator(MigrationsSqlGeneratorDependencies dependencies, IMigrationsAnnotationProvider annotations, Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure.Internal.INpgsqlOptions opts) : base(dependencies, annotations, opts) -#endif { } diff --git a/BTCPayServer.Rating/BTCPayServer.Rating.csproj b/BTCPayServer.Rating/BTCPayServer.Rating.csproj index 254d8f02b..7e92d1ac1 100644 --- a/BTCPayServer.Rating/BTCPayServer.Rating.csproj +++ b/BTCPayServer.Rating/BTCPayServer.Rating.csproj @@ -7,10 +7,9 @@ - - - - + + + diff --git a/BTCPayServer.Tests/BTCPayServer.Tests.csproj b/BTCPayServer.Tests/BTCPayServer.Tests.csproj index 285a0067b..ebbf12963 100644 --- a/BTCPayServer.Tests/BTCPayServer.Tests.csproj +++ b/BTCPayServer.Tests/BTCPayServer.Tests.csproj @@ -9,10 +9,6 @@ AB0AC1DD-9D26-485B-9416-56A33F268117 - - $(DefineConstants);NETCOREAPP21 - - $(DefineConstants);SHORT_TIMEOUT diff --git a/BTCPayServer.Tests/TestUtils.cs b/BTCPayServer.Tests/TestUtils.cs index 7a2be7612..f0b365e6b 100644 --- a/BTCPayServer.Tests/TestUtils.cs +++ b/BTCPayServer.Tests/TestUtils.cs @@ -5,9 +5,6 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -#if NETCOREAPP21 -using Microsoft.AspNetCore.Http.Internal; -#endif using Xunit.Sdk; using System.Linq; diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj index bbdfe3ebe..11b2bfb07 100644 --- a/BTCPayServer/BTCPayServer.csproj +++ b/BTCPayServer/BTCPayServer.csproj @@ -57,7 +57,6 @@ - @@ -68,9 +67,6 @@ - - - diff --git a/BTCPayServer/Controllers/ManageController.cs b/BTCPayServer/Controllers/ManageController.cs index 0e55fd1f7..0591f2d3f 100644 --- a/BTCPayServer/Controllers/ManageController.cs +++ b/BTCPayServer/Controllers/ManageController.cs @@ -19,9 +19,6 @@ using System.Globalization; using BTCPayServer.Security; using BTCPayServer.U2F; using BTCPayServer.Data; -#if NETCOREAPP21 -using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment; -#endif namespace BTCPayServer.Controllers { diff --git a/BTCPayServer/Controllers/StoresController.cs b/BTCPayServer/Controllers/StoresController.cs index 5e1faa342..70c0dad9f 100644 --- a/BTCPayServer/Controllers/StoresController.cs +++ b/BTCPayServer/Controllers/StoresController.cs @@ -32,9 +32,6 @@ using Microsoft.Extensions.Options; using NBitcoin; using NBitcoin.DataEncoders; using Newtonsoft.Json; -#if NETCOREAPP21 -using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment; -#endif namespace BTCPayServer.Controllers { diff --git a/BTCPayServer/Extensions.cs b/BTCPayServer/Extensions.cs index d55733fef..5a8b25d6f 100644 --- a/BTCPayServer/Extensions.cs +++ b/BTCPayServer/Extensions.cs @@ -41,12 +41,10 @@ namespace BTCPayServer { public static class Extensions { -#if !NETCOREAPP21 public static IQueryable Where(this Microsoft.EntityFrameworkCore.DbSet obj, System.Linq.Expressions.Expression> predicate) where TEntity : class { return System.Linq.Queryable.Where(obj, predicate); } -#endif public static string Truncate(this string value, int maxLength) { diff --git a/BTCPayServer/Extensions/ModelStateExtensions.cs b/BTCPayServer/Extensions/ModelStateExtensions.cs index fb496875f..cbdbd931b 100644 --- a/BTCPayServer/Extensions/ModelStateExtensions.cs +++ b/BTCPayServer/Extensions/ModelStateExtensions.cs @@ -1,11 +1,7 @@ using System; using System.Linq.Expressions; using Microsoft.AspNetCore.Mvc; -#if NETCOREAPP21 -using Microsoft.AspNetCore.Mvc.ViewFeatures.Internal; -#else using Microsoft.AspNetCore.Mvc.ViewFeatures; -#endif namespace BTCPayServer { @@ -17,12 +13,8 @@ namespace BTCPayServer string message, Controller controller) { -#if NETCOREAPP21 - var key = ExpressionHelper.GetExpressionText(ex); -#else var provider = (ModelExpressionProvider)controller.HttpContext.RequestServices.GetService(typeof(ModelExpressionProvider)); var key = provider.GetExpressionText(ex); -#endif controller.ModelState.AddModelError(key, message); } } diff --git a/BTCPayServer/Hosting/BTCPayServerServices.cs b/BTCPayServer/Hosting/BTCPayServerServices.cs index 0b55ed64a..0fb69e135 100644 --- a/BTCPayServer/Hosting/BTCPayServerServices.cs +++ b/BTCPayServer/Hosting/BTCPayServerServices.cs @@ -63,11 +63,7 @@ namespace BTCPayServer.Hosting { public static IServiceCollection AddBTCPayServer(this IServiceCollection services, IConfiguration configuration) { -#if NETCOREAPP21 - services.AddSingleton(); -#else services.AddSingleton(o => o.GetRequiredService>().Value); -#endif services.AddDbContext((provider, o) => { var factory = provider.GetRequiredService(); diff --git a/BTCPayServer/Hosting/ResourceBundleProvider.cs b/BTCPayServer/Hosting/ResourceBundleProvider.cs index 7945fc045..7ece95c71 100644 --- a/BTCPayServer/Hosting/ResourceBundleProvider.cs +++ b/BTCPayServer/Hosting/ResourceBundleProvider.cs @@ -6,12 +6,8 @@ using System.Reflection; using System.Text; using System.Threading.Tasks; using BundlerMinifier.TagHelpers; -#if NETCOREAPP21 -using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment; -#else using Newtonsoft.Json.Serialization; using Microsoft.AspNetCore.Hosting; -#endif using Newtonsoft.Json.Linq; namespace BTCPayServer.Hosting diff --git a/BTCPayServer/Hosting/Startup.cs b/BTCPayServer/Hosting/Startup.cs index c6b795d64..3aac9ae7e 100644 --- a/BTCPayServer/Hosting/Startup.cs +++ b/BTCPayServer/Hosting/Startup.cs @@ -1,9 +1,5 @@ using Microsoft.AspNetCore.Hosting; -#if NETCOREAPP21 -using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment; -#else using Microsoft.Extensions.Hosting; -#endif using OpenIddict.Validation.AspNetCore; using OpenIddict.Abstractions; using Microsoft.AspNetCore.Builder; @@ -78,11 +74,9 @@ namespace BTCPayServer.Hosting // ScriptSrc = "'self' 'unsafe-inline'" //}); }) -#if !NETCOREAPP21 .AddNewtonsoftJson() #if DEBUG .AddRazorRuntimeCompilation() -#endif #endif .AddControllersAsServices(); services.TryAddScoped(); @@ -239,35 +233,18 @@ namespace BTCPayServer.Hosting forwardingOptions.ForwardedHeaders = ForwardedHeaders.All; app.UseForwardedHeaders(forwardingOptions); app.UsePayServer(); -#if !NETCOREAPP21 app.UseRouting(); -#endif app.UseCors(); app.UseStaticFiles(); app.UseProviderStorage(options); app.UseAuthentication(); -#if !NETCOREAPP21 app.UseAuthorization(); -#endif app.UseSession(); -#if NETCOREAPP21 - app.UseSignalR(route => - { - AppHub.Register(route); - PaymentRequestHub.Register(route); - }); -#endif + app.UseWebSockets(); app.UseStatusCodePages(); -#if NETCOREAPP21 - app.UseMvc(routes => - { - routes.MapRoute( - name: "default", - template: "{controller=Home}/{action=Index}/{id?}"); - }); -#else + app.UseEndpoints(endpoints => { AppHub.Register(endpoints); @@ -275,7 +252,6 @@ namespace BTCPayServer.Hosting endpoints.MapControllers(); endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}"); }); -#endif } } } diff --git a/BTCPayServer/Models/GetTokensResponse.cs b/BTCPayServer/Models/GetTokensResponse.cs index a837740f2..b1f5103f9 100644 --- a/BTCPayServer/Models/GetTokensResponse.cs +++ b/BTCPayServer/Models/GetTokensResponse.cs @@ -47,11 +47,7 @@ namespace BTCPayServer.Models } context.HttpContext.Response.Headers.Add("Content-Type", new Microsoft.Extensions.Primitives.StringValues("application/json")); var str = JsonConvert.SerializeObject(jobj); -#if NETCOREAPP21 - using (var writer = new StreamWriter(context.HttpContext.Response.Body, new UTF8Encoding(false), 1024 * 10, true)) -#else await using (var writer = new StreamWriter(context.HttpContext.Response.Body, new UTF8Encoding(false), 1024 * 10, true)) -#endif { await writer.WriteAsync(str); } diff --git a/BTCPayServer/PaymentRequest/PaymentRequestHub.cs b/BTCPayServer/PaymentRequest/PaymentRequestHub.cs index d643110bd..c4443bdaf 100644 --- a/BTCPayServer/PaymentRequest/PaymentRequestHub.cs +++ b/BTCPayServer/PaymentRequest/PaymentRequestHub.cs @@ -14,10 +14,8 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.SignalR; using BTCPayServer.Data; using Microsoft.AspNetCore.Http; -#if !NETCOREAPP21 using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Builder; -#endif namespace BTCPayServer.PaymentRequest { @@ -90,11 +88,7 @@ namespace BTCPayServer.PaymentRequest return request.GetRelativePathOrAbsolute("/payment-requests/hub"); } -#if NETCOREAPP21 - public static void Register(HubRouteBuilder route) -#else public static void Register(IEndpointRouteBuilder route) -#endif { route.MapHub("/payment-requests/hub"); } diff --git a/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs b/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs index 25115d524..5554dbdc5 100644 --- a/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs +++ b/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs @@ -20,10 +20,6 @@ using BTCPayServer.Payments; using BTCPayServer.HostedServices; using NBitcoin.Altcoins.Elements; -#if NETCOREAPP21 -using IHostApplicationLifetime = Microsoft.AspNetCore.Hosting.IApplicationLifetime; -#endif - namespace BTCPayServer.Payments.Bitcoin { /// diff --git a/BTCPayServer/Services/Apps/AppHub.cs b/BTCPayServer/Services/Apps/AppHub.cs index af455b31e..6e070bbe6 100644 --- a/BTCPayServer/Services/Apps/AppHub.cs +++ b/BTCPayServer/Services/Apps/AppHub.cs @@ -5,10 +5,8 @@ using BTCPayServer.Models.AppViewModels; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.SignalR; -#if !NETCOREAPP21 using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Builder; -#endif namespace BTCPayServer.Services.Apps { @@ -70,11 +68,8 @@ namespace BTCPayServer.Services.Apps { return request.GetRelativePathOrAbsolute("/apps/hub"); } -#if NETCOREAPP21 - public static void Register(HubRouteBuilder route) -#else + public static void Register(IEndpointRouteBuilder route) -#endif { route.MapHub("/apps/hub"); } diff --git a/BTCPayServer/Services/BTCPayServerEnvironment.cs b/BTCPayServer/Services/BTCPayServerEnvironment.cs index 6e3729eea..4e0190e00 100644 --- a/BTCPayServer/Services/BTCPayServerEnvironment.cs +++ b/BTCPayServer/Services/BTCPayServerEnvironment.cs @@ -8,11 +8,7 @@ using NBXplorer; using NBitcoin; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Hosting; -#if NETCOREAPP21 -using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment; -#else using Microsoft.Extensions.Hosting; -#endif namespace BTCPayServer.Services { diff --git a/BTCPayServer/Services/Invoices/InvoiceRepository.cs b/BTCPayServer/Services/Invoices/InvoiceRepository.cs index 31226b1c1..59f5d52b5 100644 --- a/BTCPayServer/Services/Invoices/InvoiceRepository.cs +++ b/BTCPayServer/Services/Invoices/InvoiceRepository.cs @@ -89,18 +89,12 @@ retry: using (var db = _ContextFactory.CreateContext()) { return (await db.AddressInvoices -#if !NETCOREAPP21 .Include(a => a.InvoiceData.Payments) .Include(a => a.InvoiceData.RefundAddresses) -#endif #pragma warning disable CS0618 .Where(a => addresses.Contains(a.Address)) #pragma warning restore CS0618 .Select(a => a.InvoiceData) -#if NETCOREAPP21 - .Include(a => a.Payments) - .Include(a => a.RefundAddresses) -#endif .ToListAsync()).Select(ToEntity); } } diff --git a/BTCPayServer/Services/LanguageService.cs b/BTCPayServer/Services/LanguageService.cs index 078de8b5f..fd6d346d8 100644 --- a/BTCPayServer/Services/LanguageService.cs +++ b/BTCPayServer/Services/LanguageService.cs @@ -5,12 +5,7 @@ using Microsoft.Extensions.Hosting; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; -#if NETCOREAPP21 -using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment; -using Microsoft.AspNetCore.Hosting.Internal; -#else using Microsoft.AspNetCore.Hosting; -#endif namespace BTCPayServer.Services { @@ -34,11 +29,7 @@ namespace BTCPayServer.Services public LanguageService(IWebHostEnvironment environment) { -#if NETCOREAPP21 - var path = (environment as HostingEnvironment)?.WebRootPath; -#else var path = environment.WebRootPath; -#endif path = Path.Combine(path, "locales"); var files = Directory.GetFiles(path, "*.json"); var result = new List(); diff --git a/Build/Common.csproj b/Build/Common.csproj index 126a338d9..8175e8a6c 100644 --- a/Build/Common.csproj +++ b/Build/Common.csproj @@ -5,7 +5,4 @@ NU1701,CA1816,CA1308,CA1810,CA2208 8.0 - - $(DefineConstants);NETCOREAPP21 - diff --git a/btcpayserver.sln b/btcpayserver.sln index aa349bb90..ddbd0b626 100644 --- a/btcpayserver.sln +++ b/btcpayserver.sln @@ -14,6 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{29290EC7-0 Build\Common.csproj = Build\Common.csproj .circleci\config.yml = .circleci\config.yml docker-entrypoint.sh = docker-entrypoint.sh + linuxarm64v8.Dockerfile = linuxarm64v8.Dockerfile Build\Version.csproj = Build\Version.csproj EndProjectSection EndProject