Does anyone know if there is a reason _ViewStart.cshtml will not be retrieved using Custom ViewEngine in MVC 3?
My views live in
~ \ UI \ Views \
~ \ UI \ Views \ Shared \
where ViewStart is located in ~ \ UI \ Views_ViewStart.cshtml.
I cleaned up the existing RazorViewEngine and replaced it with mine in global.asax, and all views are resolved correctly, except that none of the layout pages apply unless I specify it separately in each view.
My engine code format is:
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" };
Thanks in advance, Scott
Scott source share