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 1b71dad8cb..4fab6d0001 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 @@ -1,8 +1,10 @@ using System; +using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.FileProviders; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Options; using Microsoft.Extensions.Primitives; using Volo.Abp.DependencyInjection; @@ -91,9 +93,27 @@ namespace Volo.Abp.AspNetCore.VirtualFileSystem protected virtual IFileProvider CreateFileProvider() { - return new CompositeFileProvider( + var fileProviders = new List() + { new PhysicalFileProvider(_hostingEnvironment.ContentRootPath), _virtualFileProvider + }; + + if (_hostingEnvironment.IsDevelopment() && + _hostingEnvironment.WebRootFileProvider is CompositeFileProvider compositeFileProvider) + { + var staticWebAssetsFileProvider = compositeFileProvider + .FileProviders + .FirstOrDefault(f => f.GetType().Name.Equals("StaticWebAssetsFileProvider")); + + if (staticWebAssetsFileProvider != null) + { + fileProviders.Add(staticWebAssetsFileProvider); + } + } + + return new CompositeFileProvider( + fileProviders ); }