Reputation: 21072
I had perfectly well working blazor app (like in demo -- shared project, server project and client one). I needed to move entire solution and also rename the projects. As the effect I have strange errors in web client:
App.razor: warning RZ10012: Found markup element with unexpected name 'RedirectToLogin'. If this is intended to be a component, add a @using directive for its namespace.
Index.razor: warning RZ10012: Found markup element with unexpected name 'SurveyPrompt'. If this is intended to be a component, add a @using directive for its namespace.
App.razor: error CS0246: The type or namespace name 'MainLayout' could not be found (are you missing a using directive or an assembly reference?)
App.razor.g.cs: error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type
App.razor: error CS0246: The type or namespace name 'MainLayout' could not be found (are you missing a using directive or an assembly reference?)
Of course "MainLayout" is present, same story with "SurveyPrompt". I deleted entire "bin" directory, "obj", ".vs", restarted VS and build the solution again, same outcome.
One thing which confuses me even more is "RedirectToLogin" for example is a component. I have my own component, used on several of pages, and yet there is no warning about it, so it is seen. Why then "RedirectToLogin" is not?
The error coming from compiled razor file I guess is safe to ignore for a moment, because it can be caused by previous errors and warnings.
For the record, I have to rename the projects, so I cannot solve this by reverting all the name changes.
Upvotes: 2
Views: 8548
Reputation: 21072
On every warning/error report against "MainLayout" or "RedirectToLogin", I edited given file and added entire namespace for it. Looking at their names "BlazorApp.Client.Shared.MainLayout" I realized somehow conflict with project namespaces could happen -- "BlazorApp.Client.Shared" is folder within client while "BlazorApp.Shared" is project.
On the other hand conflict could occur if there are two same entities within two distinct reachable namespaces. Namespaces are reachable, but "MainLayout" for example is only once defined.
Problem solved, pity I don't fully understand why it worked before and what was broken after renaming.
Upvotes: 3