dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.38k stars 10k forks source link

BlazorServer.styles.css #45787

Closed khteh closed 1 year ago

khteh commented 1 year ago

Is there an existing issue for this?

Describe the bug

Where is <link href="BlazorServer.styles.css" rel="stylesheet" />? I don't find it anywhere in the bootstrapped application! https://dotnet.microsoft.com/en-us/learn/aspnet/blazor-tutorial/create

Refused to apply style from 'https://myapp/BlazorServer.styles.css' because its MIME type ('') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

7.0.101

Anything else?

No response

ConnerOrth commented 1 year ago

From memory this should be in the index.html file of the blazor project.

javiercn commented 1 year ago

@khteh thanks for contacting us.

The file is autogenerated and served via static web assets during development. It is copied into the wwwroot folder of the published app during publish. The file follows the naming convention <<appName>>.styles.css. If you want to inspect it, is inside the obj folder during development.

It typically is loaded inside the _Host.cshtml file in Blazor Server applications.

khteh commented 1 year ago

Why the runtime console error?

javiercn commented 1 year ago

@khteh if you look at the network tab, it is likely that something else is being served instead.

khteh commented 1 year ago

Screenshot from 2022-12-28 17-51-07

javiercn commented 1 year ago

@khteh The response coming from the server is a 404, so that is why you are seeing that error in the browser console.

That can be because the name of the file in the link does not match the naming convention, because you have disabled scoped CSS, or because you removed all the scoped CSS files.