|
|
|
@ -181,43 +181,6 @@ public static class AbpApplicationBuilderExtensions |
|
|
|
throw new AbpException("The app(IApplicationBuilder) is not an IEndpointRouteBuilder."); |
|
|
|
} |
|
|
|
|
|
|
|
var environment = endpoints.ServiceProvider.GetRequiredService<IWebHostEnvironment>(); |
|
|
|
if (environment.IsDevelopment()) |
|
|
|
{ |
|
|
|
// MapStaticAssets in development mode will have a performance issue if there are many static files.
|
|
|
|
// https://github.com/dotnet/aspnetcore/issues/59673
|
|
|
|
app.UseStaticFiles(); |
|
|
|
|
|
|
|
if (!staticAssetsManifestPath.IsNullOrWhiteSpace()) |
|
|
|
{ |
|
|
|
app.ApplicationServices.GetRequiredService<ILogger<AbpAspNetCoreModule>>().LogWarning( |
|
|
|
$"The staticAssetsManifestPath({staticAssetsManifestPath}) parameter your provided in MapAbpStaticAssets method is ignored in development mode."); |
|
|
|
} |
|
|
|
|
|
|
|
var blazorClientProjectPaths = new[] |
|
|
|
{ |
|
|
|
Path.Combine(AppContext.BaseDirectory, $"{environment.ApplicationName}.Client.staticwebassets.endpoints.json"), |
|
|
|
Path.Combine(AppContext.BaseDirectory, $"{environment.ApplicationName.RemovePostFix(".Host")}.Blazor.staticwebassets.endpoints.json"), |
|
|
|
}; |
|
|
|
|
|
|
|
var blazorClientStaticAssetsManifest = blazorClientProjectPaths.FirstOrDefault(File.Exists); |
|
|
|
if (blazorClientStaticAssetsManifest != null) |
|
|
|
{ |
|
|
|
// We have a blazor client project and we need to map the static assets from the client project.
|
|
|
|
var blazorHostStaticAssetsManifest = Path.Combine(AppContext.BaseDirectory, $"{environment.ApplicationName}.staticwebassets.endpoints.json"); |
|
|
|
File.Copy(blazorClientStaticAssetsManifest, blazorHostStaticAssetsManifest, true); |
|
|
|
return endpoints.MapStaticAssets(blazorHostStaticAssetsManifest); |
|
|
|
} |
|
|
|
|
|
|
|
// Volo.Abp.AspNetCore.staticwebassets.endpoints.json is an empty file. Just compatible with the return type of MapAbpStaticAssets.
|
|
|
|
var tempStaticAssetsManifestPath = Path.Combine(AppContext.BaseDirectory, "Volo.Abp.AspNetCore.staticwebassets.endpoints.json"); |
|
|
|
if (!File.Exists(tempStaticAssetsManifestPath)) |
|
|
|
{ |
|
|
|
File.WriteAllText(tempStaticAssetsManifestPath, "{\"Version\":1,\"ManifestType\":\"Build\",\"Endpoints\":[]}"); |
|
|
|
} |
|
|
|
return endpoints.MapStaticAssets(tempStaticAssetsManifestPath); |
|
|
|
} |
|
|
|
|
|
|
|
var options = app.ApplicationServices.GetRequiredService<IOptions<AbpAspNetCoreContentOptions>>().Value; |
|
|
|
foreach (var folder in options.AllowedExtraWebContentFolders) |
|
|
|
{ |
|
|
|
|