dotnet / dotnet/aspnetcore

Visual Studio 2022 Template "ASP.NET Core Web App" converts hyphens to underscores in _Layout.cshtml css href, causing 404 on the css when debug/run.

Open
#44,787 1 comment 0 reactions 0 assignees View on GitHub
area-mvc feature-css-isolation feature-templates investigate
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

Using Visual Studio 2022 Template "ASP.NET Core Web App", the new project converts hyphens to underscores in _Layout.cshtml css href for the css "isolation" file.

I know this seems minor but I (stupidly) spent a lot of time before I noticed the conversion of hyphens to underscores and I found a bunch of other issues related to css isolation here so thought this may help someone.

Note that command line `dotnet new razor` doesn't have this issue (which is how I found the resolution).

### Expected Behavior

Don't do that.

### Steps To Reproduce

Create new project using the above template with project named "test-asp-net-6-app". After project is created the stylesheet link is created with underscores instead of hyphens causing a 404 on the style sheet when running the app.

**_Layout.cshtml**
``

![image](https://user-images.githubusercontent.com/8396655/198847396-35ed16c5-1c8d-4541-b5ef-693308654356.png)

The build/runtime is expecting a style sheet file with hyphens: `test-asp-net-6-app.styles.css`

### Exceptions (if any)

_No response_

### .NET Version

6.0.402

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.