Skip to content
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

Blazor: Error on adding new scoped CSS since last update #55998

Closed
vsfeedback opened this issue May 31, 2024 · 4 comments
Closed

Blazor: Error on adding new scoped CSS since last update #55998

vsfeedback opened this issue May 31, 2024 · 4 comments
Labels
area-blazor Includes: Blazor, Razor Components Author: Migration Bot 🤖 The issue was created by a issue mover bot. The author may not be the actual author. Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. Status: No Recent Activity

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


[severity:I'm unable to use this version] [regression] [worked-in:Just before 2022 (64-bit) V 17.10.1]
Steps to Reproduce:

  1. Open the Blazor project in Visual Studio.
  2. Navigate to the desired location in the Solution Explorer where you want to add a new CSS file.
  3. Use the shortcut Ctrl + Shift + A or right-click in the Solution Explorer and select 'Add' from the context menu to add a new CSS file.
  4. Name the new file as 'IEButton.razor.css' and place it under the 'ImportExport' directory.
  5. Ensure that the associated Razor component 'IEButton.razor' exists in the same 'ImportExport' directory.
  6. Visual Studio correctly recognizes 'IEButton.razor.css' as a style sheet scoped to 'IEButton.razor'.
  7. Attempt to compile the project.

Expected Result:
The project should compile successfully without any errors, recognizing 'IEButton.razor.css' as a scoped CSS file for the 'IEButton.razor' component.

Actual Result:
The following build error is encountered:

Error (active) BLAZOR102 The scoped css file 'ImportExport\IEButton.razor.css' was defined but no associated razor component or view was found for it.

Despite the existence of the associated Razor component, the compiler fails to recognize it and throws an error indicating no associated Razor component or view was found for the scoped CSS file.

Note that previously scoped CSS files remain completely functional. The compiler error only points to a newly added scoped CSS file.

I saw this behavior starting yesterday when I last updated Visual Studio Community.


Original Comments

(no comments)


Original Solutions

(no solutions)

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label May 31, 2024
@wtgodbe
Copy link
Member

wtgodbe commented May 31, 2024

Possibly related? #39344

@dotnet-policy-service dotnet-policy-service bot added the Author: Migration Bot 🤖 The issue was created by a issue mover bot. The author may not be the actual author. label May 31, 2024
@javiercn
Copy link
Member

javiercn commented Jun 3, 2024

@wtgodbe I don't think this issue is related, since the other one involved compilation.

@javiercn
Copy link
Member

javiercn commented Jun 3, 2024

Thanks for contacting us.

Can you check on your csproj file if the .razor file that you've added has been removed for any reason from the Content ItemGroup? You'll see something like <Content Remove="ImportExport.razor" /> and it typically is followed by something like <None Include="ImportExport.razor" />

Do you have any issue if you build from the command line with dotnet build?

If so, can you produce a minimal repro project that demonstrates the issue or attach a MSBuild binlog file to the original Visual Studio User Voice ticket? See https://github.com/dotnet/project-system-tools#build-logging for instructions on how to do this from visual studio.

Please DO NOT INCLUDE the binlog here, only on the original ticket.

@javiercn javiercn added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Jun 3, 2024
Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

See our Issue Management Policies for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components Author: Migration Bot 🤖 The issue was created by a issue mover bot. The author may not be the actual author. Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. Status: No Recent Activity
Projects
None yet
Development

No branches or pull requests

3 participants