-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error creating a "Blazor Web App" project with space in project name #52519
Comments
Thanks for contacting us. We're moving this issue to the |
Thanks for contacting us. This is because you have spaces in the project name. It should work without spaces. |
Sorry this has nothing to do with a blank in the project name. I created the project using the 'Blazor Web App template'. The only thing I entered was the name of BlazorApp. Everything else stayed the same. The interactive render mode is set to auto. When the project runs it gets a 404 trying to load the BlazorApp.styles.css. I'm running this on: Using: Installed Version: Professional ASP.NET and Web Tools 17.8.358.6298 Razor (ASP.NET Core) 17.8.3.2358002+8c7fb27bf8e8d4f9ff8080b624b35bca5e812e97 |
My hosting environment variable was set to Local. Changing to Development fixed the issue with the CSS not working. I'm not sure why when I launch the project it fails to pick up the environment from the launchsettings? The project name never contained a space. |
Not sure, if it's really the same issue with hyphens, but could be. |
It's not exactly the same issue, but it's very similar, and we plan on addressing both at the same time. |
The hyphen issue seems different. You can create a Blazor project with a hyphen in its name and that builds and runs fine. But if you then try to add a class to the project using VS, the added class uses the project name for the namespace, but you can't have a namespace with a hyphen in it, so the added class fails to compile. I think this is a VS issue, not a Blazor issue. @mkArtakMSFT I think we may need to reopen this VS feedback ticket and get it to the right team. |
I think this IS an issue with the blazor template specifically, as other templates all generate the proper RootNamespace element in the project file. simple repro: c:\repros blazor-web.csproj has the following - note the dash in the rootnamespace (this is incorrect) aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/RazorPagesWeb-CSharp.csproj.in Line 9 in 7412c71
While the razor-web.csproj has - note how the rootnamespace has the proper safenamespace aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/RazorPagesWeb-CSharp.csproj.in Line 9 in 7412c71
I think this is due to the dashes being used in the Blazor.csproj.in file - the Blazor template is using a dash in the source name instead of Company.WebApplication1 like all the other templates are doing, this is causing the safenamespace to not generate properly by the value form |
Thanks @phenning for explaining these details! We'll look at the hyphen issue then as part of this issue as originally planned. |
I came across this ticket via (maybe relevant): SpecFlow includes hyphens from the Project name for the namespace references inside its generated feature class files on build. So invalid class syntax and plenty of build errors ensue. |
This issue has been moved from a ticket on Developer Community.
[severity:It bothers me. A fix would be nice]
Today I updated Visual studio community 2022 to the Preview version (17.9.0 Preview 1.1), I created a project with these characteristics:
Project Type: Blazor Web App
Frameworks: .NET 8.0
Authentication type: Individual accounts
Interactive render mode: None
Immediately after creation without making any changes I started the project, and this error appears in the browser console:
"Web%20Client.styles.css:1 Failed to load resource: the server responded with a status of 404 ()"
I checked, and this file does not appear in any folder of the project, I tried to delete and recreate the project, but I have the same problem, I also started Visual Studio as administrator, deleted and recreated the project, but it gives the same problem.
Original Comments
Feedback Bot on 11/28/2023, 04:53 PM:
(private comment, text removed)
Original Solutions
(no solutions)
The text was updated successfully, but these errors were encountered: