Like to have some of the razor pages as blazor components in a different assembly, What is the procedure and best-practice to do this?
BlazorComponents --> Type of Razor Class Library, I placed counter.razor here
BlazorServerApp
In the Imports I imported the @using BlazorComponents
namespace,
but when running seems still doesn't have access to counter page via /counter
Using all the latest versions.
Taken from the Microsoft docs here - https://learn.microsoft.com/en-us/aspnet/core/blazor/routing?view=aspnetcore-3.1
Use the AdditionalAssemblies parameter to specify additional assemblies for the Router component to consider when searching for routable components. Specified assemblies are considered in addition to the AppAssembly-specified assembly. In the following example, Component1 is a routable component defined in a referenced class library. The following AdditionalAssemblies example results in routing support for Component1:
<Router
AppAssembly="typeof(Program).Assembly"
AdditionalAssemblies="new[] { typeof(Component1).Assembly }">
...
</Router>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With