as the WASM and server are separate projects, you probably need 3 projects. one for the shared code, one for the Blazor components, and one for the server project.
How to share a Blazor WebAssembly component that is ASP.NET Core Hosted using a single Razor Class Library?
I have a functioning Blazor WebAssembly (WASM) component that I would like to share with other apps. The component is ASP.NET Core hosted and my solution contains multiple project files (client, server, shared). The client-side project (the component) interacts with Web API endpoints in a controller file in the server-side project to pull data from a SQL Server database.
What I am unsure of is how to best share a WASM component with multiple other projects in a ASP.NET Core hosted environment. Apparently, directly adding/referencing the client-side WASM project does not work and using Razor Class Libraries (RCLs) is the suggested recommended approach (reference). However, I have been unable to find information on using RCLs in a hosted environment where a component-specific controller is involved.
How can I best share my client-side Blazor WASM component including its server-side controller using a single Razor Class Library? Is this even possible?