dotnet / dotnet/aspnetcore

net6.0 mvc css isolation filename mismatch when using a hyphen

Open
#49,660 4 comments 1 reaction 0 assignees View on GitHub
area-ui-rendering bug feature-templates
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Describe the bug
When creating a new dotnet 6.0 project from the mvc template using the dotnet cli, if you use a hyphen in the project name and build the project, the bundled `project-name.styles.css` filename will contain a hyphen (matching the project), but the href in `_Layout.cshtml` will use an underscore (matching the namespace).

The obvious workaround is to not use hyphens in the project name, but this seems like a bug regardless.

### To Reproduce
```
user@os:~/Projects$ dotnet new mvc --name bad-filename
user@os:~/Projects$ cd bad-filename
user@os:~/bad-filename$ dotnet build
user@os:~/bad-filename$ ls obj/Debug/net6.0/scopedcss/bundle
bad-filename.styles.css
user@os:~/bad-filename$ cat Views/Shared/_Layout.cshtml
...

...
```

### Exceptions (if any)
None

### Further technical details
- Include the output of `dotnet --info`
```
.NET SDK (reflecting any global.json):
Version: 6.0.119
Commit: 044cde2ce0

Runtime Environment:
OS Name: pop
OS Version: 22.04
OS Platform: Linux
RID: ubuntu.22.04-x64
Base Path: /usr/lib/dotnet/sdk/6.0.119/

global.json file:
Not found

Host:
Version: 6.0.19
Architecture: x64
Commit: e37fab9fc9

.NET SDKs installed:
6.0.119 [/usr/lib/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.19 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.19 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

Download .NET:
https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs:
https://aka.ms/dotnet/runtimes-sdk-info

```
- The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
VS Code 1.80.0

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.