Code generation problem if project name contains "-" (dash, minus)
See original GitHub issueDescribe the bug
dotnet new mvc
command produces faulty style reference if project name contains - character.
To Reproduce
Using cli version 6.0.2.
mkdir cloud-manager
cd cloud-manager
dotnet new mvc
Further technical details
The cli generated the project successfuly. But the _layout.cshtml file has a reference to “cloud_manager.styles.css” which needs to be “cloud-manager.styles.css”. So until changing the _ to -, the site doesn’t look properly due to a 404 error.
The generator seems falsely to use root namespace name instead of project output name.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Are there problems with hyphens in functions, aliases, and ...
dash is the default shell ( /bin/sh ) on the debian-ubuntu family and it does not support hyphens in function names:
Read more >[question] why names cannot contain dash '-' · Issue #479
For example, the majority of programming languages don't support - inside property names so it will make code/typings generation harder.
Read more >Java Package with hyphen in name - import
No, I can't change the package name, I'm getting an: error '.' expected . The line giving the error is: import poof-support.exception;. java ......
Read more >values containing dash - not evaluated
but there is no error and i get return values as if there really does not exist this filed. the column name is...
Read more >Are there semantic differences using a dash '-' vs. an ...
The dash symbol (ASCII code = 45 or 0x2D) usually means minus, not dash. So programming languages does not allow this symbol in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My recommendation is to change
sourceName
intemplate.json
toCompany.WebApplication.1
here(https://github.com/dotnet/aspnetcore/blob/f902dd8e154b2d20555a294ce83d21ddffaee8c4/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/.template.config/template.json#L24). Then in template content:Company.WebApplication.1
in the template, including hereCompany.WebApplication._1
andCompany_WebApplication_1
respectively.@sayedihashimi just a heads up, this issue is a good candidate to be included in template validation, happened already couple of times.
Thanks for contacting us, @buraksarica. @vlada-shubina what do we put here to make sure that it matches the project name?