I have a Blazor class which I’m trying to include in a component with @inherits like so:
@page "/Users"
@inherits MyApp.Client.Pages.UsersBase
...
The Base class, UsersBase.cs:
using Microsoft.AspNetCore.Components;
namespace MyApp.Client.Pages
{
public class UsersBase: ComponentBase
{
//...code...
}
}
When I try compiling my project I get an error:
The type or namespace name “Pages” does not exist in the namespace “MyApp.Client” in Components_Pages_Users_razor.g.cs
The file, Components_Pages_Users_razor.g.cs, existed in the obj folder, so I tried both clearing the “bin” and “obj” files and rebuilding the solution. Neither solved the problem.
What is causing this?