有谁知道 _ViewStart.cshtml 是否有理由在 MVC 3 中使用自定义 ViewEngine 不被选中?
我的观点现在住在
〜\用户界面\视图\
~\UI\视图\共享\
ViewStart 位于 ~\UI\Views_ViewStart.cshtml。
我已经清除了现有的 RazorViewEngine 并在 global.asax 中将其替换为我的,并且所有视图都正确解析,除非我在每个视图中单独指定它,否则不会应用任何布局页面。
我的引擎路径格式代码是:
this.ViewLocationFormats = new[]
{
"~/UI/Views/{1}/{0}.cshtml",
"~/UI/Views/Shared/{0}.cshtml"
};
this.PartialViewLocationFormats = new[]
{
"~/UI/Views/Shared/{0}.cshtml",
"~/UI/Views/Shared/Partial/{0}.cshtml",
"~/UI/Views/{1}/Partial/{0}.cshtml"
};
this.AreaMasterLocationFormats = new[]
{
"~/UI/Views/Admin/Shared/{0}.cshtml"
};
this.AreaPartialViewLocationFormats = new[]
{
"~/UI/Views/Admin/Shared/{0}.cshtml",
"~/UI/Views/Admin/Shared/Partial/{0}.cshtml"
};
this.AreaViewLocationFormats = new[] { "~/UI/Views/Admin/{1}/{0}.cshtml" };
this.MasterLocationFormats = new[]
{
"~/UI/Views/{1}/{0}.cshtml",
"~/UI/Views/Shared/{0}.cshtml"
};
在此先感谢,斯科特