moh*_*eli 5 asp.net-mvc reusability razor
我无法重用来自另一个程序集的cshtml文件。这是裸露的样本:
ViewReuseViewLibraryMicrosoft.AspNetCore.All在ViewLibrary中添加对metapackage 的引用ReusedLayout.cshtmlEmbeddedResources Include='Views\**\*.cshtml'到ViewLibrary的csproj,以将ViewLibrary.dll中的所有视图包括在内services.AddMvc().ConfigureApplicationPartManager(p => { p.ApplicationParts.Add(new AssemblyPart(typeof(ReusedController).Assembly)); });About.cshtml为使用ViewLibrary中的布局:Layout = "/Views/Shared/ReusedLayout.cshtml"/home/about。对我来说,我遇到了这个错误:
InvalidOperationException:找不到布局视图“ /Views/Shared/ReusedLayout.cshtml”。搜索了以下位置:/Views/Shared/ReusedLayout.cshtml
我做错了什么?我该如何解决这个问题?
| 归档时间: |
|
| 查看次数: |
902 次 |
| 最近记录: |