博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
去除无用的文件查找路径
阅读量:5807 次
发布时间:2019-06-18

本文共 1699 字,大约阅读时间需要 5 分钟。

protected void Application_Start()

{ 

            ......

            //调试时合并文件

            //BundleTable.EnableOptimizations = true;
            //去除无用文件查找路径,添加自己的文件夹
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new RazorViewEngine()
            {
                ViewLocationFormats = new string[] {
                     "~/Views/{1}/{0}.cshtml",
                     "~/Views/MyViews/{1}/{0}.cshtml",
                     "~/Views/Shared/{0}.cshtml"
                }
            });

}

void PureViewEngines()        {            //移除 集合中 默认添加的 WebFormViewEngine            ViewEngines.Engines.RemoveAt(0);            RazorViewEngine razor = ViewEngines.Engines[0] as RazorViewEngine;            //移除RazorViewEngine中的 vbhtml 路径模版。            razor.FileExtensions = new string[] { "cshtml" };            razor.AreaMasterLocationFormats = new string[]{                 "~/Areas/{2}/Views/{1}/{0}.cshtml",                 "~/Areas/{2}/Views/Shared/{0}.cshtml"            };            razor.AreaPartialViewLocationFormats = new string[]{                 "~/Areas/{2}/Views/{1}/{0}.cshtml",                 "~/Areas/{2}/Views/Shared/{0}.cshtml"            };            razor.AreaViewLocationFormats = new string[] {               "~/Areas/{2}/Views/{1}/{0}.cshtml",               "~/Areas/{2}/Views/Shared/{0}.cshtml"           };            razor.MasterLocationFormats = new string[]{                 "~/Views/{1}/{0}.cshtml",                 "~/Views/Shared/{0}.cshtml"            };            razor.PartialViewLocationFormats = new string[]{                 "~/Views/{1}/{0}.cshtml",                 "~/Views/Shared/{0}.cshtml"            };            razor.ViewLocationFormats = new string[]{                 "~/Views/{1}/{0}.cshtml",                 "~/Views/Shared/{0}.cshtml"            };        }

 

转载于:https://www.cnblogs.com/dotnetmvc/p/3667865.html

你可能感兴趣的文章
Java重写equals方法和hashCode方法
查看>>
Spark API编程动手实战-07-join操作深入实战
查看>>
EasyUI基础入门之Easyloader(载入器)
查看>>
Spring ’14 Wave Update: Installing Dynamics CRM on Tablets for Windows 8.1
查看>>
MySQL 备份与恢复
查看>>
TEST
查看>>
PAT A1037
查看>>
ReactiveSwift源码解析(三) Signal代码的基本实现
查看>>
(六)Oracle学习笔记—— 约束
查看>>
[Oracle]如何在Oracle中设置Event
查看>>
top.location.href和localtion.href有什么不同
查看>>
02-创建hibernate工程
查看>>
Scrum之 Sprint计划会议
查看>>
svn命令在linux下的使用
查看>>
Gradle之module间依赖版本同步
查看>>
java springcloud版b2b2c社交电商spring cloud分布式微服务(十五)Springboot整合RabbitMQ...
查看>>
SpringCloud使用Prometheus监控(基于Eureka)
查看>>
10g手动创建数据库
查看>>
Spring MVC EL表达式不能显示
查看>>
Windwos Server 2008 R2 DHCP服务
查看>>