From 361902fffaa96943bfa0ff347e7efeb06ee59648 Mon Sep 17 00:00:00 2001 From: maliming <6908465+maliming@users.noreply.github.com> Date: Mon, 23 Sep 2024 18:36:44 +0800 Subject: [PATCH] Add `MapStaticAssets`. --- .../AbpApplicationBuilderExtensions.cs | 31 +++++++++++++++++++ .../WebContentFileProvider.cs | 24 +++++++------- .../AbpAspNetCoreMvcUiBootstrapDemoModule.cs | 2 +- .../AbpAspNetCoreMvcUiThemeBasicDemoModule.cs | 2 +- .../BloggingTestAppModule.cs | 2 +- .../ClientSimulationDemoModule.cs | 2 +- .../CmsKitHttpApiHostModule.cs | 2 +- .../CmsKitIdentityServerModule.cs | 2 +- .../CmsKitWebHostModule.cs | 2 +- .../CmsKitWebUnifiedModule.cs | 2 +- .../app/VoloDocs.Web/VoloDocsWebModule.cs | 2 +- .../app/OpenIddict.Demo.Client.Mvc/Program.cs | 2 +- .../app/OpenIddict.Demo.Server/Program.cs | 2 +- .../DemoAppModule.cs | 2 +- .../AbpVirtualFileExplorerDemoAppModule.cs | 2 +- .../MyProjectNameModule.cs | 2 +- .../MyProjectNameModule.cs | 2 +- .../Server.Mongo/MyProjectNameHostModule.cs | 2 +- .../Server/MyProjectNameHostModule.cs | 2 +- .../MyProjectNameModule.cs | 2 +- .../MyProjectNameModule.cs | 2 +- .../MyProjectNameModule.cs | 2 +- .../MyProjectNameModule.cs | 2 +- .../MyProjectNameAuthServerModule.cs | 2 +- .../MyProjectNameBlazorModule.cs | 2 +- .../MyProjectNameBlazorModule.cs | 2 +- .../MyProjectNameBlazorModule.cs | 2 +- .../MyProjectNameBlazorModule.cs | 2 +- .../Program.cs | 2 +- .../MyProjectNameHttpApiHostModule.cs | 2 +- .../MyProjectNameHttpApiHostModule.cs | 2 +- .../MyProjectNameWebModule.cs | 2 +- .../MyProjectNameWebModule.cs | 3 +- .../MyProjectNameAuthServerModule.cs | 2 +- .../Program.cs | 2 +- .../MyProjectNameBlazorHostModule.cs | 2 +- .../MyProjectNameHttpApiHostModule.cs | 2 +- .../MyProjectNameWebHostModule.cs | 2 +- .../MyProjectNameWebUnifiedModule.cs | 2 +- 39 files changed, 82 insertions(+), 48 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs index 730fe98533c..ee8d879c795 100644 --- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs @@ -1,9 +1,14 @@ using System; +using System.IO; using System.Threading.Tasks; using JetBrains.Annotations; +using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.RequestLocalization; +using Microsoft.AspNetCore.Routing; +using Microsoft.AspNetCore.StaticAssets; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Options; using Volo.Abp; using Volo.Abp.AspNetCore.Auditing; using Volo.Abp.AspNetCore.ExceptionHandling; @@ -11,8 +16,10 @@ using Volo.Abp.AspNetCore.Security.Claims; using Volo.Abp.AspNetCore.Tracing; using Volo.Abp.AspNetCore.Uow; +using Volo.Abp.AspNetCore.VirtualFileSystem; using Volo.Abp.DependencyInjection; using Volo.Abp.Threading; +using Volo.Abp.VirtualFileSystem; namespace Microsoft.AspNetCore.Builder; @@ -117,4 +124,28 @@ public static IApplicationBuilder UseDynamicClaims(this IApplicationBuilder app) { return app.UseMiddleware(); } + + public static StaticAssetsEndpointConventionBuilder MapStaticAssets(this IApplicationBuilder app, string? staticAssetsManifestPath = null) + { + if (app is not IEndpointRouteBuilder endpoints) + { + throw new AbpException("The app(IApplicationBuilder) is not an IEndpointRouteBuilder."); + } + + var contentTypeProvider = endpoints.ServiceProvider.GetRequiredService(); + var webContentFileProvider = new WebContentFileProvider( + endpoints.ServiceProvider.GetRequiredService(), + null, + endpoints.ServiceProvider.GetRequiredService>() + ); + + app.UseStaticFiles(new StaticFileOptions() + { + ContentTypeProvider = contentTypeProvider, + FileProvider = webContentFileProvider + }); + + var result = endpoints.MapStaticAssets(staticAssetsManifestPath); + return result; + } } diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/WebContentFileProvider.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/WebContentFileProvider.cs index 9814dd8c970..b6e5e1ed215 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/WebContentFileProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/WebContentFileProvider.cs @@ -15,14 +15,14 @@ public class WebContentFileProvider : IWebContentFileProvider, ISingletonDepende { private readonly IVirtualFileProvider _virtualFileProvider; private readonly IFileProvider _fileProvider; - private readonly IWebHostEnvironment _hostingEnvironment; + private readonly IWebHostEnvironment? _hostingEnvironment; private string _rootPath = "/wwwroot"; protected AbpAspNetCoreContentOptions Options { get; } public WebContentFileProvider( IVirtualFileProvider virtualFileProvider, - IWebHostEnvironment hostingEnvironment, + IWebHostEnvironment? hostingEnvironment, IOptions options) { _virtualFileProvider = virtualFileProvider; @@ -85,8 +85,8 @@ public virtual IChangeToken Watch(string filter) return new CompositeChangeToken( new[] { - _fileProvider.Watch(_rootPath + filter), - _fileProvider.Watch(filter) + _fileProvider.Watch(_rootPath + filter), + _fileProvider.Watch(filter) } ); } @@ -94,14 +94,16 @@ public virtual IChangeToken Watch(string filter) protected virtual IFileProvider CreateFileProvider() { var fileProviders = new List - { - new PhysicalFileProvider(_hostingEnvironment.ContentRootPath), - _virtualFileProvider - }; + { + _virtualFileProvider + }; - return new CompositeFileProvider( - fileProviders - ); + if (_hostingEnvironment != null) + { + fileProviders.Add(_hostingEnvironment.WebRootFileProvider); + } + + return new CompositeFileProvider(fileProviders); } protected virtual bool ExtraAllowedFolder(string path) diff --git a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/AbpAspNetCoreMvcUiBootstrapDemoModule.cs b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/AbpAspNetCoreMvcUiBootstrapDemoModule.cs index 654ada13fcb..23c61fad9e2 100644 --- a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/AbpAspNetCoreMvcUiBootstrapDemoModule.cs +++ b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/AbpAspNetCoreMvcUiBootstrapDemoModule.cs @@ -31,7 +31,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex } app.UseRouting(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseConfiguredEndpoints(); } diff --git a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/AbpAspNetCoreMvcUiThemeBasicDemoModule.cs b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/AbpAspNetCoreMvcUiThemeBasicDemoModule.cs index 1b1a3f34694..7d4e465470b 100644 --- a/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/AbpAspNetCoreMvcUiThemeBasicDemoModule.cs +++ b/modules/basic-theme/test/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Demo/AbpAspNetCoreMvcUiThemeBasicDemoModule.cs @@ -55,7 +55,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex app.UseDeveloperExceptionPage(); } - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseConfiguredEndpoints(); } diff --git a/modules/blogging/app/Volo.BloggingTestApp/BloggingTestAppModule.cs b/modules/blogging/app/Volo.BloggingTestApp/BloggingTestAppModule.cs index 37ce9e4f699..0dbb2a6d855 100644 --- a/modules/blogging/app/Volo.BloggingTestApp/BloggingTestAppModule.cs +++ b/modules/blogging/app/Volo.BloggingTestApp/BloggingTestAppModule.cs @@ -161,7 +161,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex app.UseErrorPage(); } - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); diff --git a/modules/client-simulation/demo/Volo.ClientSimulation.Demo/ClientSimulationDemoModule.cs b/modules/client-simulation/demo/Volo.ClientSimulation.Demo/ClientSimulationDemoModule.cs index 006fb8c3a52..e7ca6c4a47e 100644 --- a/modules/client-simulation/demo/Volo.ClientSimulation.Demo/ClientSimulationDemoModule.cs +++ b/modules/client-simulation/demo/Volo.ClientSimulation.Demo/ClientSimulationDemoModule.cs @@ -40,7 +40,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex app.UseDeveloperExceptionPage(); } - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseConfiguredEndpoints(); } diff --git a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/CmsKitHttpApiHostModule.cs b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/CmsKitHttpApiHostModule.cs index aeb45bea028..a9472dfb8a9 100644 --- a/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/CmsKitHttpApiHostModule.cs +++ b/modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/CmsKitHttpApiHostModule.cs @@ -172,7 +172,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex app.UseHttpsRedirection(); app.UseCorrelationId(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseCors(DefaultCorsPolicyName); app.UseAuthentication(); diff --git a/modules/cms-kit/host/Volo.CmsKit.IdentityServer/CmsKitIdentityServerModule.cs b/modules/cms-kit/host/Volo.CmsKit.IdentityServer/CmsKitIdentityServerModule.cs index 070508d1784..79b6ffae922 100644 --- a/modules/cms-kit/host/Volo.CmsKit.IdentityServer/CmsKitIdentityServerModule.cs +++ b/modules/cms-kit/host/Volo.CmsKit.IdentityServer/CmsKitIdentityServerModule.cs @@ -195,7 +195,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex app.UseHttpsRedirection(); app.UseCorrelationId(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseCors(DefaultCorsPolicyName); app.UseAuthentication(); diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Host/CmsKitWebHostModule.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Host/CmsKitWebHostModule.cs index 4ca31dc44a2..ab6b6dc0f99 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Host/CmsKitWebHostModule.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Host/CmsKitWebHostModule.cs @@ -222,7 +222,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex } app.UseHttpsRedirection(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseAuthentication(); diff --git a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs index cb515032b64..c328ef77f0b 100644 --- a/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs +++ b/modules/cms-kit/host/Volo.CmsKit.Web.Unified/CmsKitWebUnifiedModule.cs @@ -263,7 +263,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex } app.UseHttpsRedirection(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseAuthentication(); diff --git a/modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs b/modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs index 8651c0d3fd3..ec56cc6036c 100644 --- a/modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs +++ b/modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs @@ -177,7 +177,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex var app = context.GetApplicationBuilder(); var env = context.GetEnvironment(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); diff --git a/modules/openiddict/app/OpenIddict.Demo.Client.Mvc/Program.cs b/modules/openiddict/app/OpenIddict.Demo.Client.Mvc/Program.cs index 108919797a6..9f8238afe25 100644 --- a/modules/openiddict/app/OpenIddict.Demo.Client.Mvc/Program.cs +++ b/modules/openiddict/app/OpenIddict.Demo.Client.Mvc/Program.cs @@ -49,7 +49,7 @@ } app.UseHttpsRedirection(); -app.UseStaticFiles(); +app.MapStaticAssets(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); diff --git a/modules/openiddict/app/OpenIddict.Demo.Server/Program.cs b/modules/openiddict/app/OpenIddict.Demo.Server/Program.cs index dd16dfb75b1..1edfd57f31d 100644 --- a/modules/openiddict/app/OpenIddict.Demo.Server/Program.cs +++ b/modules/openiddict/app/OpenIddict.Demo.Server/Program.cs @@ -47,7 +47,7 @@ } app.UseHttpsRedirection(); -app.UseStaticFiles(); +app.MapStaticAssets(); app.UseRouting(); app.UseCors(); app.UseAuthentication(); diff --git a/modules/setting-management/app/Volo.Abp.SettingManagement.DemoApp/DemoAppModule.cs b/modules/setting-management/app/Volo.Abp.SettingManagement.DemoApp/DemoAppModule.cs index 0f89cb54d95..8f7ec0a51e0 100644 --- a/modules/setting-management/app/Volo.Abp.SettingManagement.DemoApp/DemoAppModule.cs +++ b/modules/setting-management/app/Volo.Abp.SettingManagement.DemoApp/DemoAppModule.cs @@ -120,7 +120,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex } app.UseHttpsRedirection(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); diff --git a/modules/virtual-file-explorer/app/Volo.Abp.VirtualFileExplorer.DemoApp/AbpVirtualFileExplorerDemoAppModule.cs b/modules/virtual-file-explorer/app/Volo.Abp.VirtualFileExplorer.DemoApp/AbpVirtualFileExplorerDemoAppModule.cs index 4f6965207d8..ea4d24ef076 100644 --- a/modules/virtual-file-explorer/app/Volo.Abp.VirtualFileExplorer.DemoApp/AbpVirtualFileExplorerDemoAppModule.cs +++ b/modules/virtual-file-explorer/app/Volo.Abp.VirtualFileExplorer.DemoApp/AbpVirtualFileExplorerDemoAppModule.cs @@ -38,7 +38,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex { var app = context.GetApplicationBuilder(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseAbpRequestLocalization(); app.UseConfiguredEndpoints(); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/MyProjectNameModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/MyProjectNameModule.cs index 1a8c3874827..10f5e035c5c 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/MyProjectNameModule.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server.Mongo/MyProjectNameModule.cs @@ -367,7 +367,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex app.UseHttpsRedirection(); app.UseCorrelationId(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseAuthentication(); app.UseAbpOpenIddictValidation(); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameModule.cs index 783e82a050d..af5c335654c 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameModule.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameModule.cs @@ -384,7 +384,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex app.UseHttpsRedirection(); app.UseCorrelationId(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseAuthentication(); app.UseAbpOpenIddictValidation(); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server.Mongo/MyProjectNameHostModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server.Mongo/MyProjectNameHostModule.cs index e88bc89e45c..4b93f6e3dd6 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server.Mongo/MyProjectNameHostModule.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server.Mongo/MyProjectNameHostModule.cs @@ -311,7 +311,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex app.UseCorrelationId(); app.UseBlazorFrameworkFiles(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseCors(); app.UseAuthentication(); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/MyProjectNameHostModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/MyProjectNameHostModule.cs index 7767fec5cb4..8464e71ab3f 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/MyProjectNameHostModule.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Blazor.WebAssembly/Server/MyProjectNameHostModule.cs @@ -330,7 +330,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex app.UseCorrelationId(); app.UseBlazorFrameworkFiles(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseCors(); app.UseAuthentication(); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyProjectNameModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyProjectNameModule.cs index 388b34fea6a..9b626826c9a 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyProjectNameModule.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host.Mongo/MyProjectNameModule.cs @@ -350,7 +350,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex } app.UseCorrelationId(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseCors(); app.UseAuthentication(); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyProjectNameModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyProjectNameModule.cs index 36cfc450628..0bd591aee0b 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyProjectNameModule.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Host/MyProjectNameModule.cs @@ -368,7 +368,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex } app.UseCorrelationId(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseCors(); app.UseAuthentication(); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyProjectNameModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyProjectNameModule.cs index 5484aff3b5b..01915fd9c75 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyProjectNameModule.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc.Mongo/MyProjectNameModule.cs @@ -332,7 +332,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex } app.UseCorrelationId(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseAuthentication(); app.UseAbpOpenIddictValidation(); diff --git a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyProjectNameModule.cs b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyProjectNameModule.cs index 10313aaa856..37080dbd944 100644 --- a/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyProjectNameModule.cs +++ b/templates/app-nolayers/aspnet-core/MyCompanyName.MyProjectName.Mvc/MyProjectNameModule.cs @@ -349,7 +349,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex } app.UseCorrelationId(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseAuthentication(); app.UseAbpOpenIddictValidation(); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs index e8c1dd46462..cc9b5082d1a 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs @@ -206,7 +206,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex } app.UseCorrelationId(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseCors(); app.UseAuthentication(); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyProjectNameBlazorModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyProjectNameBlazorModule.cs index dad869db4db..5dd67c995b8 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyProjectNameBlazorModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyProjectNameBlazorModule.cs @@ -361,7 +361,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex } app.UseCorrelationId(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseAuthentication(); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameBlazorModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameBlazorModule.cs index e1e9a212d54..fdd149901cc 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameBlazorModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/MyProjectNameBlazorModule.cs @@ -271,7 +271,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex app.UseHttpsRedirection(); app.UseCorrelationId(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseAuthentication(); app.UseAbpOpenIddictValidation(); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered/MyProjectNameBlazorModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered/MyProjectNameBlazorModule.cs index b9cee433634..5535341c75d 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered/MyProjectNameBlazorModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered/MyProjectNameBlazorModule.cs @@ -364,7 +364,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex } app.UseCorrelationId(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseAuthentication(); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp/MyProjectNameBlazorModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp/MyProjectNameBlazorModule.cs index 11e0e75f6ce..dad29d9cc4c 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp/MyProjectNameBlazorModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp/MyProjectNameBlazorModule.cs @@ -274,7 +274,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex app.UseHttpsRedirection(); app.UseCorrelationId(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseAuthentication(); app.UseAbpOpenIddictValidation(); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Program.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Program.cs index 9fae4422f11..b7882b254aa 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Program.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor/Program.cs @@ -33,7 +33,7 @@ app.UseHttpsRedirection(); -app.UseStaticFiles(); +app.MapStaticAssets(); app.UseAntiforgery(); app.MapRazorComponents() diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs index 2c0b3838e0d..5f056f2518b 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs @@ -188,7 +188,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex app.UseAbpRequestLocalization(); app.UseCorrelationId(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseCors(); app.UseAuthentication(); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs index 9e2863aca44..0b4c344a06f 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs @@ -193,7 +193,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex } app.UseCorrelationId(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseCors(); app.UseAuthentication(); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs index 777d3e8886a..73a6b075952 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs @@ -313,7 +313,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex } app.UseCorrelationId(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseAuthentication(); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs index 3d36e378f6f..9a8ca6db61d 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs @@ -1,3 +1,4 @@ +using System; using System.IO; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Extensions.DependencyInjection; @@ -225,7 +226,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex } app.UseCorrelationId(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseAuthentication(); app.UseAbpOpenIddictValidation(); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs index ad5ba841444..c3deb7a69df 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs @@ -210,7 +210,7 @@ public async override Task OnApplicationInitializationAsync(ApplicationInitializ app.UseHttpsRedirection(); app.UseCorrelationId(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseCors(); app.UseAuthentication(); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/Program.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/Program.cs index 99c5702ed3c..cddfdec7d46 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/Program.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Host/Program.cs @@ -33,7 +33,7 @@ app.UseHttpsRedirection(); -app.UseStaticFiles(); +app.MapStaticAssets(); app.UseAntiforgery(); app.MapRazorComponents() diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/MyProjectNameBlazorHostModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/MyProjectNameBlazorHostModule.cs index 4451d010a08..b81992c44dd 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/MyProjectNameBlazorHostModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/MyProjectNameBlazorHostModule.cs @@ -254,7 +254,7 @@ public override async Task OnApplicationInitializationAsync(ApplicationInitializ app.UseHttpsRedirection(); app.UseCorrelationId(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseAuthentication(); app.UseAbpOpenIddictValidation(); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs index bb759d23860..cefb3559ff3 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs @@ -175,7 +175,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex app.UseHttpsRedirection(); app.UseCorrelationId(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseCors(); app.UseAuthentication(); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs index f17251116fb..db6ada6730b 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs @@ -240,7 +240,7 @@ public override void OnApplicationInitialization(ApplicationInitializationContex } app.UseHttpsRedirection(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseAuthentication(); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs index 8174c0d9eea..5fa8bbe0b50 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs @@ -158,7 +158,7 @@ public async override Task OnApplicationInitializationAsync(ApplicationInitializ } app.UseHttpsRedirection(); - app.UseStaticFiles(); + app.MapStaticAssets(); app.UseRouting(); app.UseAuthentication();