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.44k stars 10.02k forks source link

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

Open TheWurst opened 1 year ago

TheWurst commented 1 year ago

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

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
nagilson commented 1 year ago

@marcpopMSFT Where is the list of owners for each template? I assume we would want the authors of the MVC template to take a look at this

marcpopMSFT commented 1 year ago

We have an internal wiki tracking this though it doesn't break out each individual template: https://dev.azure.com/devdiv/DevDiv/_wiki/wikis/DevDiv.wiki/25742/Template-engine

This one should be aspnet.

mkArtakMSFT commented 1 year ago

This is indeed a bug but as a workaround we recommend customers to not use special characters in project names.

ghost commented 1 year 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.