I have a project built with .NET 8 Blazor: I have the server and the client project. The build will be deployed under a web application in IIS.
For that, I added in the appconfig.json a key to check the base path and set it in the App.xaml
@inject IConfiguration Configuration@{ var basePath = Configuration["BasePath"] ?? "/"; basePath = basePath.EndsWith("/") ? basePath : basePath +"/";}<!DOCTYPE html><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><base href="@basePath" /><link rel="stylesheet" href="myproject.styles.css" />And also in the Program.cs
var basePath = builder.Configuration.GetValue<string>("BasePath") ?? "";if (!string.IsNullOrEmpty(basePath)){ app.UsePathBase(basePath); app.MapBlazorHub($"{basePath}/_blazor");}else app.MapBlazorHub("/_blazor");The application is working fine in the Development mode. When I use the pipeline in the Release mode, on the server, the generated CSS and the files coming from the packages (such as js and css) are missing.
How can I fix it?
Screenshot
Here you can see the issues with the missing files
If I inspect the code, I see Blazor is doing its job

