Skip to content

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

Open
@TheWurst

Description

@TheWurst

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
  ...
  <link rel="stylesheet" href="~/bad_filename.styles.css" asp-append-version="true" />
  ...

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-ui-renderingIncludes: MVC Views/Pages, Razor Views/PagesbugThis issue describes a behavior which is not expected - a bug.feature-templates

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions