From 029bf1175a03b7c3be09d7e99f94636b57472e52 Mon Sep 17 00:00:00 2001 From: gdlcf88 Date: Sun, 29 Dec 2024 19:04:36 +0800 Subject: [PATCH] Upgrade to ABP 9.0.2 --- .github/workflows/publish.yml | 2 +- Directory.Build.props | 2 +- common.props | 2 +- ...syAbp.Abp.TagHelperPlus.Host.Shared.csproj | 2 +- ...syAbp.Abp.TagHelperPlus.Web.Unified.csproj | 10 +-- .../Program.cs | 78 ++++++++++--------- .../Startup.cs | 20 ----- .../TagHelperPlusWebUnifiedModule.cs | 2 +- .../package.json | 2 +- .../EasyAbp.Abp.TagHelperPlus.csproj | 2 +- 10 files changed, 54 insertions(+), 68 deletions(-) delete mode 100644 host/EasyAbp.Abp.TagHelperPlus.Web.Unified/Startup.cs diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fc7d0ef..845a70c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,7 +12,7 @@ jobs: - uses: NuGet/setup-nuget@v1 - uses: actions/setup-dotnet@v3 with: - dotnet-version: '8.0.x' + dotnet-version: '9.0.x' - name: read common.props id: commonProps diff --git a/Directory.Build.props b/Directory.Build.props index ee55437..bb62cde 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - 8.3.2 + 9.0.2 \ No newline at end of file diff --git a/common.props b/common.props index f057591..9247267 100644 --- a/common.props +++ b/common.props @@ -1,7 +1,7 @@ latest - 2.3.0 + 2.4.0 $(NoWarn);CS1591 true EasyAbp Team diff --git a/host/EasyAbp.Abp.TagHelperPlus.Host.Shared/EasyAbp.Abp.TagHelperPlus.Host.Shared.csproj b/host/EasyAbp.Abp.TagHelperPlus.Host.Shared/EasyAbp.Abp.TagHelperPlus.Host.Shared.csproj index f8a0132..fbe82c7 100644 --- a/host/EasyAbp.Abp.TagHelperPlus.Host.Shared/EasyAbp.Abp.TagHelperPlus.Host.Shared.csproj +++ b/host/EasyAbp.Abp.TagHelperPlus.Host.Shared/EasyAbp.Abp.TagHelperPlus.Host.Shared.csproj @@ -3,7 +3,7 @@ - net8.0 + net9.0 EasyAbp.Abp.TagHelperPlus diff --git a/host/EasyAbp.Abp.TagHelperPlus.Web.Unified/EasyAbp.Abp.TagHelperPlus.Web.Unified.csproj b/host/EasyAbp.Abp.TagHelperPlus.Web.Unified/EasyAbp.Abp.TagHelperPlus.Web.Unified.csproj index 55737b9..d7bc140 100644 --- a/host/EasyAbp.Abp.TagHelperPlus.Web.Unified/EasyAbp.Abp.TagHelperPlus.Web.Unified.csproj +++ b/host/EasyAbp.Abp.TagHelperPlus.Web.Unified/EasyAbp.Abp.TagHelperPlus.Web.Unified.csproj @@ -3,7 +3,7 @@ - net8.0 + net9.0 EasyAbp.Abp.TagHelperPlus true EasyAbp.Abp.TagHelperPlus-c2d31439-b723-48e2-b061-5ebd7aeb6010 @@ -13,11 +13,11 @@ - - - + + + - + diff --git a/host/EasyAbp.Abp.TagHelperPlus.Web.Unified/Program.cs b/host/EasyAbp.Abp.TagHelperPlus.Web.Unified/Program.cs index 87f972f..4770b8e 100644 --- a/host/EasyAbp.Abp.TagHelperPlus.Web.Unified/Program.cs +++ b/host/EasyAbp.Abp.TagHelperPlus.Web.Unified/Program.cs @@ -1,50 +1,56 @@ using System; -using System.IO; -using Microsoft.AspNetCore.Hosting; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Serilog; using Serilog.Events; -namespace EasyAbp.Abp.TagHelperPlus +namespace EasyAbp.Abp.TagHelperPlus; + +public class Program { - public class Program + public async static Task Main(string[] args) { - public static int Main(string[] args) - { - Log.Logger = new LoggerConfiguration() - .MinimumLevel.Debug() - .MinimumLevel.Override("Microsoft", LogEventLevel.Information) - .Enrich.FromLogContext() - .WriteTo.Async(c => c.File("Logs/logs.txt")) + Log.Logger = new LoggerConfiguration() #if DEBUG - .WriteTo.Async(c => c.Console()) + .MinimumLevel.Debug() +#else + .MinimumLevel.Information() #endif - .CreateLogger(); + .MinimumLevel.Override("Microsoft", LogEventLevel.Information) + .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning) + .Enrich.FromLogContext() + .WriteTo.Async(c => c.File("Logs/logs.txt")) + .WriteTo.Async(c => c.Console()) + .CreateLogger(); - try - { - Log.Information("Starting web host."); - CreateHostBuilder(args).Build().Run(); - return 0; - } - catch (Exception ex) - { - Log.Fatal(ex, "Host terminated unexpectedly!"); - return 1; - } - finally + try + { + Log.Information("Starting web host."); + var builder = WebApplication.CreateBuilder(args); + builder.Host.AddAppSettingsSecretsJson() + .UseAutofac() + .UseSerilog(); + await builder.AddApplicationAsync(); + var app = builder.Build(); + await app.InitializeApplicationAsync(); + await app.RunAsync(); + return 0; + } + catch (Exception ex) + { + if (ex is HostAbortedException) { - Log.CloseAndFlush(); + throw; } - } - internal static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup(); - }) - .UseAutofac() - .UseSerilog(); + Log.Fatal(ex, "Host terminated unexpectedly!"); + return 1; + } + finally + { + Log.CloseAndFlush(); + } } -} +} \ No newline at end of file diff --git a/host/EasyAbp.Abp.TagHelperPlus.Web.Unified/Startup.cs b/host/EasyAbp.Abp.TagHelperPlus.Web.Unified/Startup.cs deleted file mode 100644 index ab32211..0000000 --- a/host/EasyAbp.Abp.TagHelperPlus.Web.Unified/Startup.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; - -namespace EasyAbp.Abp.TagHelperPlus -{ - public class Startup - { - public void ConfigureServices(IServiceCollection services) - { - services.AddApplication(); - } - - public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) - { - app.InitializeApplication(); - } - } -} diff --git a/host/EasyAbp.Abp.TagHelperPlus.Web.Unified/TagHelperPlusWebUnifiedModule.cs b/host/EasyAbp.Abp.TagHelperPlus.Web.Unified/TagHelperPlusWebUnifiedModule.cs index 720e9e4..7e6a5df 100644 --- a/host/EasyAbp.Abp.TagHelperPlus.Web.Unified/TagHelperPlusWebUnifiedModule.cs +++ b/host/EasyAbp.Abp.TagHelperPlus.Web.Unified/TagHelperPlusWebUnifiedModule.cs @@ -155,7 +155,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex } app.UseHttpsRedirection(); - app.UseStaticFiles(); + app.MapAbpStaticAssets(); app.UseRouting(); app.UseAuthentication(); diff --git a/host/EasyAbp.Abp.TagHelperPlus.Web.Unified/package.json b/host/EasyAbp.Abp.TagHelperPlus.Web.Unified/package.json index 345d8fe..51dccd7 100644 --- a/host/EasyAbp.Abp.TagHelperPlus.Web.Unified/package.json +++ b/host/EasyAbp.Abp.TagHelperPlus.Web.Unified/package.json @@ -3,6 +3,6 @@ "name": "my-app", "private": true, "dependencies": { - "@abp/aspnetcore.mvc.ui.theme.leptonxlite": "~3.3.2" + "@abp/aspnetcore.mvc.ui.theme.leptonxlite": "~4.0.3" } } \ No newline at end of file diff --git a/src/EasyAbp.Abp.TagHelperPlus/EasyAbp.Abp.TagHelperPlus.csproj b/src/EasyAbp.Abp.TagHelperPlus/EasyAbp.Abp.TagHelperPlus.csproj index e61132b..c20aa95 100644 --- a/src/EasyAbp.Abp.TagHelperPlus/EasyAbp.Abp.TagHelperPlus.csproj +++ b/src/EasyAbp.Abp.TagHelperPlus/EasyAbp.Abp.TagHelperPlus.csproj @@ -3,7 +3,7 @@ - net8.0 + net9.0