From d4dbca8b0c9cfc82531aae5a5a4862a904cb9912 Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 12 Sep 2025 17:58:59 +0800 Subject: [PATCH] Remove obsolete features. https://learn.microsoft.com/en-us/dotnet/core/compatibility/aspnet-core/10/razor-runtime-compilation-obsolete https://learn.microsoft.com/en-us/dotnet/core/compatibility/aspnet-core/10/iactioncontextaccessor-obsolete --- .../AbpMvcBuilderExtensions.cs | 19 +------------------ .../Volo.Abp.AspNetCore.Mvc.csproj | 1 - .../AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs | 8 -------- .../AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs | 3 --- 4 files changed, 1 insertion(+), 30 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpMvcBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpMvcBuilderExtensions.cs index 57aa64be6a..5d66ec7821 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpMvcBuilderExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/Extensions/DependencyInjection/AbpMvcBuilderExtensions.cs @@ -1,11 +1,7 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Reflection; using Microsoft.AspNetCore.Mvc.ApplicationParts; -using Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation; -using Volo.Abp.AspNetCore.VirtualFileSystem; -using Volo.Abp.DependencyInjection; namespace Microsoft.Extensions.DependencyInjection; @@ -31,17 +27,4 @@ public static class AbpMvcBuilderExtensions applicationParts.Add(new AssemblyPart(assembly)); } - - public static void AddAbpRazorRuntimeCompilation(this IMvcCoreBuilder mvcCoreBuilder) - { - mvcCoreBuilder.AddRazorRuntimeCompilation(); - mvcCoreBuilder.Services.Configure(options => - { - options.FileProviders.Add( - new RazorViewEngineVirtualFileProvider( - mvcCoreBuilder.Services.GetSingletonInstance>() - ) - ); - }); - } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj index b29d8d0533..98b18f9d39 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj @@ -30,7 +30,6 @@ - diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs index ba1bfd0437..c3fc470ed8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs @@ -139,20 +139,12 @@ public class AbpAspNetCoreMvcModule : AbpModule }) .AddViewLocalization(); //TODO: How to configure from the application? Also, consider to move to a UI module since APIs does not care about it. - if (context.Services.GetHostingEnvironment().IsDevelopment() && - context.Services.ExecutePreConfiguredActions().EnableRazorRuntimeCompilationOnDevelopment) - { - mvcCoreBuilder.AddAbpRazorRuntimeCompilation(); - } - mvcCoreBuilder.AddAbpJson(); context.Services.ExecutePreConfiguredActions(mvcBuilder); //TODO: AddViewLocalization by default..? - context.Services.TryAddSingleton(); - //Use DI to create controllers mvcBuilder.AddControllersAsServices(); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs index 548981053d..6df0ace0fa 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs @@ -20,8 +20,6 @@ public class AbpAspNetCoreMvcOptions public bool AutoModelValidation { get; set; } - public bool EnableRazorRuntimeCompilationOnDevelopment { get; set; } - public bool ChangeControllerModelApiExplorerGroupName { get; set; } public AbpAspNetCoreMvcOptions() @@ -30,7 +28,6 @@ public class AbpAspNetCoreMvcOptions IgnoredControllersOnModelExclusion = new HashSet(); ControllersToRemove = new HashSet(); AutoModelValidation = true; - EnableRazorRuntimeCompilationOnDevelopment = true; ChangeControllerModelApiExplorerGroupName = true; } }