例如,我有两个类似的简单 MVC 应用程序。
Application1
:
HomeController
->Index
返回AnotherHome
视图的操作
Application2
:
AnotherHomeController
->AnotherIndex
也返回AnotherHome
视图的操作
Application1 索引操作:
public ActionResult Index()
{
return View("AnotherHome");
}
我需要运行Application1
和渲染AnotherHome
。当我运行应用程序时,很明显我收到以下错误:
The view 'AnotherHome' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Home/AnotherHome.aspx
~/Views/Home/AnotherHome.ascx
~/Views/Shared/AnotherHome.aspx
~/Views/Shared/AnotherHome.ascx
~/Views/Home/AnotherHome.cshtml
~/Views/Home/AnotherHome.vbhtml
~/Views/Shared/AnotherHome.cshtml
~/Views/Shared/AnotherHome.vbhtml
如何强制视图引擎搜索视图,例如Application2/Views/AnotherHome/AnotherIndex.cshtml
???