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.15k stars 9.92k forks source link

[Razor] CSS Isolation not working when special characters in project name #40668

Open Kazem-ma79 opened 2 years ago

Kazem-ma79 commented 2 years ago

Is there an existing issue for this?

Describe the bug

When having (space, dash, underline) in project name, CSS Isolation won't work. Tested by an empty ASP.NET Core MVC project with .NET 6. First made a project named "MVC CSS-Isolation" but it didn't work and getting error "MVC_CSS_Isolation.css 404 not found" in browser console. After that, made another project name "MVCIsolation" and CSS Isolation worked fine.

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

6.0.201

Anything else?

No response

javiercn commented 2 years ago

@Kazem-ma79 thanks for contacting us.

That's likely an inconsistency between the code generated by the template and the actual CSS generated file. I suspect that if you change the file to MVC CSS-Isolation.styles.css in _Layout.cshtml things will work.

ghost commented 2 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

CoderLittleChen commented 1 year ago

@javiercn When project name start with num,I encounter the same problem.eg 03.TestDemo

javiercn commented 1 year ago

@CoderLittleChen I would suggest a similar solution to what's described https://github.com/dotnet/aspnetcore/issues/40668#issuecomment-1066648408. Update the code in the generated template to match the project name.

CoderLittleChen commented 1 year ago

@javiercn Thank you, I got it

cpatel22 commented 3 months ago

Any update on this?