我有一个具有以下结构的简单RCL:
/Pages
/Shared/
_Footer.cshtml
内容很简单:
<h3> _Footer.cshtml partial view.</h3>
Run Code Online (Sandbox Code Playgroud)
我也有一个具有相同文件夹结构的ASP.NET Core Web App项目:
/Pages
_ViewImports.cshtml
-ViewStart.cshtml
/Shared
_Layout.cshtml
我在布局文件中的某个地方引用了局部视图:
<partial name="_Footer" />
这是问题所在:
The partial view '_Footer' was not found. The following locations were searched: /Pages/_Footer.cshtml /Pages/Shared/_Footer.cshtml /Views/Shared/_Footer.cshtml
添加项目参考和Nuget参考之间有什么区别?我已经验证了Nuget包确实包含了类库的默认程序集和视图程序集。
小智 2
我遇到了同样的问题,解决了从图书馆区域写入完整路径的问题,例如:
在图书馆我有:
区域/页脚/页面/_footer.cshtml
在我的 UI Proyect 中,我这样称呼它:<partial name="~/Areas/Footer/Pages/_footer.cshtml" model="My Model instance"/>
我希望它能帮助你
| 归档时间: |
|
| 查看次数: |
734 次 |
| 最近记录: |