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.46k stars 10.03k forks source link

Creating a Blazor project with a space in its name breaks the styling #52196

Open danroth27 opened 11 months ago

danroth27 commented 11 months ago

This user created their first Blazor app with a project that had a space in its name, which broke downloading the styles bundle: https://github.com/dotnet/core/issues/8939.

Repro steps:

Expected result: App runs fine Actual result:

image

javiercn commented 11 months ago

@danroth27 It's been that way since Blazor 3.0/3.1 and MVC.

It's a well-known template/bug/limitation, I believe.

javiercn commented 11 months ago

Dug out how to do this.

Should be doable I think with a generated parameter and a regex like:

{
  "regex": " ",             //The regular expression whose matches will be replaced with '[Replaced]`
  "replacement": "_"   //The value to replace matches of the expression '^test' with
},

Then we would need to change that in the layout, so that it replaces AssemblyName.styles.css or similar.

https://github.com/dotnet/templating/wiki/Available-Symbols-Generators#samples-7

ghost commented 11 months ago

Thanks for contacting us.

We're moving this issue to the .NET 9 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

javiercn commented 11 months ago

Adding to the symbols

"StyleBundleName":{
  "type": "generated",
  "generator": "regex",
  "replaces": "StyleBundleName",
  "parameters": {
    "source": "name",
    "steps": [
      {
        "regex": " ",
        "replacement": "_"
      }
    ]
  }
},

And

<link rel="stylesheet" href="BlazorWebStyleBundleName.styles.css" />

to App.Razor should fix it.

We should do this across all our templates.

ghost commented 10 months ago

Thanks for contacting us.

We're moving this issue to the .NET 9 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

halter73 commented 8 months ago

We get a report from VS feedback that hyphens in the project name also break compilation of the template.