Reputation: 4645
We have a cshtml-View that is invoking a ViewComponent like this:
@await Component.InvokeAsync("WetterAPIViewComponent")
The ViewComponent itself is defined like that:
[ViewComponent(Name = "WetterAPIViewComponent")]
public class WetterAPIViewComponent : ViewComponent
{
// ...
}
So it has the ViewComponent attribute, is public and non-abstract.
Unfortunately, I still get the following error:
System.InvalidOperationException: 'A view component named 'WetterAPIViewComponent' could not be found. A view component must be a public non-abstract class, not contain any generic parameters, and either be decorated with 'ViewComponentAttribute' or have a class name ending with the 'ViewComponent' suffix. A view component must not be decorated with 'NonViewComponentAttribute'.'
What am I doing wrong here?
Thanks in advance
Upvotes: 0
Views: 360
Reputation: 36715
Your code are prettily good working. Try to right-click the project to Clean and Rebuild the project.
Upvotes: 2