I have a visual studio solution containing several blazor web application projects.Each of the applications has a requirement to use several identical components.I should like to place web assembly components in a shared project, add them as project references and include them in the _imports.razor file and include them on the pages of the various web applications.
I have placed the 'counter' component in the shared project and added it to a page:
<Counter @rendermode="InteractiveAuto"/>
But running the project gives me the following error:
InvalidOperationException: A component of type 'myawesomenamespace.Counter' has render mode 'InteractiveAutoRenderMode', but the required endpoints are not mapped on the server. When calling 'MapRazorComponents', add a call to 'AddInteractiveServerRenderMode'. For example, 'builder.MapRazorComponents<...>.AddInteractiveServerRenderMode()'
This line:
app.MapRazorComponents<web.components.App>().AddInteractiveWebAssemblyRenderMode().AddAdditionalAssemblies(typeof(wasm._imports).Assembly);
is present in the server Program.cs file.
If I exclude the '@rendermode="InteractiveAuto"' directive, the component renders but the button doesn't work.
Are interactive components in a shared project even possible?