void ClearEngine()
{
// 移除 默认已经加载的Aspx 实体引擎
ViewEngines.Engines.RemoveAt(0);
//获取razor 视图引擎
RazorViewEngine razor= ViewEngines.Engines[0] as RazorViewEngine;
// 修改 区域视图 默认位置 格式
string[] areaViewLocationFormats = new string[2]{
"~/Areas/{2}/Views/{1}/{0}.cshtml",
"~/Areas/{2}/Views/Shared/{0}.cshtml" };
razor.AreaViewLocationFormats = areaViewLocationFormats;
razor.AreaPartialViewLocationFormats = areaViewLocationFormats;
razor.AreaMasterLocationFormats = areaViewLocationFormats;
//修改视图默认位置格式
string[] viewLocalFormats = new string[2]
{
"~/Views/{1}/{0}.cshtml",
"~/Views/Shared/{0}.cshtml"};
razor.ViewLocationFormats = viewLocalFormats;
razor.PartialViewLocationFormats = viewLocalFormats;
razor.MasterLocationFormats = viewLocalFormats;
}
----在gloable中 添加这个方法 就只会