简体   繁体   English

多个项目中的 Blazor 页面

[英]Blazor pages in multiple projects

I have 3 projects Projection.Server - this contains the host file and startups Projection.Shared - This contains the controllers and pages (class library) Components.Shared - This contains all components to be used throughout the projects (class library)我有 3 个项目 Projection.Server - 这包含主机文件和启动 Projection.Shared - 这包含控制器和页面(类库) Components.Shared - 这包含要在整个项目中使用的所有组件(类库)

My question is that i have all my pages within Projection.Shared for that project but i want to be able to have a page within Components.Shared for my login page that can be used by multiple projects when this solution expands but when i create a login page within the Components.Shared it is unable to direct to the page and says:我的问题是,我在 Projection.Shared 中拥有该项目的所有页面,但我希望能够在 Components.Shared 中为我的登录页面创建一个页面,当此解决方案扩展但当我创建一个时,多个项目可以使用该页面Components.Shared 中的登录页面无法定向到该页面并说:

Sorry, there's nothing at this address.抱歉,此地址没有任何内容。

I assume this is the case because the RouteData inside my App.Razor which is situated within Projection.Shared therefore cant access the pages within Components.Shared, is there a possible way round this?我认为是这种情况,因为我的 App.Razor 中的 RouteData 位于 Projection.Shared 中,因此无法访问 Components.Shared 中的页面,有没有可能的方法来解决这个问题?

I figured out the answer, in case anybody else runs into this in the future.我想出了答案,以防将来有人遇到这个问题。 Adding the below to the App.Razor file allows it to look at multiple projects:将以下内容添加到App.Razor文件允许它查看多个项目:

AdditionalAssemblies = "new[] { typeof(Shared.Components.App).Assembly }"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM