Search code examples
asp.netasp.net-coreblazor-server-sidefluent-ui

Blazor Fluent UI example doesn't generate styles.css


I am looking to try out the Fluent UI example template and noticed some strange behavior.

In the documentation it states that you need to add this to your _Layout.cshtml.

<link href="{PROJECT_NAME}.styles.css" rel="stylesheet" />

So if I had a project called Web.csproj, the link href would be Web.styles.css. However, this doesn't seem to resolve, even for a default project:

The project's name is FluentUI-Server and the URL to the stylesheet is FluentUI_Server.styles.css

The browser shows a 404 retrieving FluentUI_Server.styles.css

Even when I tried with a project named 'Web', it wasn't able to resolve the css file. I notice the UI is styled with a "constructed stylesheet" but it's annoying that I'd see these errors in the console if everything is OK. Am I missing something?


Solution

  • I tried to reproduce your issue:

    enter image description here

    In my opinion,"-" is not allowed in the namespace(I'd never added "-" in project name),and it was convertered to "_" in your codes when create the project,but your assembly name is FluentUI-Server instead of FluentUI_Server

    just modify

    <link href="FluentUI_Server1.styles.css" rel="stylesheet" />
    

    to

    <link href="FluentUI-Server1.styles.css" rel="stylesheet" />
    

    It's ok now:

    enter image description here