admin管理员组

文章数量:1387360

We are using .NET 8 and want to use CSS isolation.

In my program.cs file, I have this code:

var builder = WebApplication.CreateBuilder(args);

builder.WebHost.UseStaticWebAssets();

// .....
app.UseStaticFiles();

// ...

I then create a local .css file associated to a page and then in the head section of app.razor I place:

<link rel="stylesheet" href="_content/[MyAssemblyName].styles.css" />

Through explorer I can see that within the solutions

obj\Debug\net8.0\scopedcss\projectbundle 

there is a file

[MyAssemblyName].bundle.scp.css

When I run my project, and look at the dev tools, I see a 404 error relating to my file. Opening the file I can see my isolated .css.

本文标签: cIssue using CSS Isolation in Blazor ServerStack Overflow