79730749

Date: 2025-08-09 16:49:37
Score: 1
Natty:
Report link

I didn’t get the exact same error as you, but my setup is very similar, so here are my two cents:

Solution
│
├── MyApp         // Server project. Set InteractiveWebAssembly or InteractiveAuto globally in App.razor
│
├── MyApp.Client  // Contains Routes.razor
│
└── SharedRCL     // Contains Counter.razor page (@page "/counter") without setting any render mode

In Routes.razor, make sure the Router is aware of routable components in the Razor Class Library (RCL) by adding the RCL’s assembly:

<Router AppAssembly="@typeof(Program).Assembly"
        AdditionalAssemblies="new[] { typeof(Counter).Assembly }">  @* <-- This line here *@
    ...
</Router>

Depending on your setup, you might also need to ensure that the server knows about routable components in the RCL. In MyApp/Program.cs, register the same assembly when mapping Razor components:

app.MapRazorComponents<App>()
    .AddInteractiveWebAssemblyRenderMode()
    .AddAdditionalAssemblies(typeof(MyApp.Client._Imports).Assembly)
    .AddAdditionalAssemblies(typeof(Counter).Assembly); // <-- This line here
Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • Me too answer (2.5): get the exact same error
Posted by: Abdelhakim