Blazor Web App: How to correctly open razor pages from referenced projects in new tabs?

25 Views Asked by At

I manually updated my app from Blazor Server to the new Blazor Web App (InteractiveServerRenderMode(prerender: true)). Almost everything works fine as it did before but I noticed a strange error that I currently can't solve.

My actual project is only a container for a Json config file and I use an own framework (referenced projects) for all the business logic and razor pages I have. I even create the side menu of the app using my config file. This concept allows me to configure a custom application fast and easily.

I take the configured deeplinks from the settings file and assign them to my navigation menu using Fluent UI:

@foreach (var menuItem in menuGroup.MenuItems)
            {
                    @{
                        Icon icon = null;
                        try
                        {
                            icon = Icons.GetInstance(new IconInfo() { Name = menuItem.IconName, Size = IconSize.Size20, Variant = IconVariant.Regular });
                        }
                        catch {}
                    }
                    <FluentNavLink Icon="@icon" data-icon-name="@menuItem.IconName" Href="@menuItem.Url" Match="NavLinkMatch.All">@menuItem.Label</FluentNavLink>
            }

Navigating to the pages using the menu within the current tab works fine, no matter if the razor files are placed in the main or a referenced project. But clicking "open in new tab" (needed for multi-screen usage), results in a 404 error:

404 error

I have found out that this only applies to razor pages from referenced projects, which is strange because in Routes.razor I have the following lines that enable the app to find pages from other assemblies:

<Router AppAssembly="@typeof(Program).Assembly"
        AdditionalAssemblies="new[]
        {
            typeof(ReferencedProject.Components.Layout.Dashboard).Assembly
        }">
    ...
</Router>

I dont' get why I the app definitely is able to open the pages in the same tab but not in another and why it works only for pages placed within the same projects even though the other projects are refereced. Does anyone of you have an idea? I would be thankful for any help.

Connor

What I have already tried:

  • debugging with my app and framework and also creating a new demo project to make sure that the issue is not connected to my code
  • google / ChatGPT but Blazor Web app is quite new and most of the people don't seem to have the need to open multiple tabs from a web app, so I didn't have success yet
0

There are 0 best solutions below