有没有办法删除 asp.net mvc web.config 文件中的程序集和命名空间声明?
我正在尝试使用 razor 引擎创建一个空的 asp.net mvc 3 应用程序(尽可能空)
VS2010 创建的那个不适合我,因为 web.config 文件太乱了(加上大量的脚本、样式和包等)
有没有一种优雅的方法可以将所有混乱隐藏在其他地方(但不在 machine.config 中)并处理漂亮的空 web.config 文件(至少在站点根目录中)?
如果没有,也许有人可以给我一些链接,了解所有这些自动生成的配置的含义(例如 dependentAssembly 定义)以及为什么需要它们。
谢谢,让我们保持代码干净=)
i'm trying to make an empty asp.net mvc 3 application with razor engine(as much empty as possible)
The one that VS2010 creates doesn't suit me, because there's too much mess in web.config files(+ plenty of scripts and styles and packages etc)
Is there an elegant way to hide this all mess somewhere else(but not in machine.config) and to deal with nice empty web.config file(at least at site root)?
And if not, maybe someone can give me some links about what all this autogenerated configurations mean(like dependentAssembly definition) and why they are needed.
Thank you, lets keep our code clean=)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在创建 ASP.NET MVC 应用程序时使用空模板,然后使用以下最小的 web.config 来成功呈现 Razor 视图:
此外,您在 web.config 中所说的“混乱”只是一个如果您想使用某些功能(例如表单身份验证),则需要满足此要求。但您可以根据自己的需要逐步添加相应的部分。我同意 Visual Studio 生成的默认 web.config 中有很多无用的废话。
You could use the Empty template when creating the ASP.NET MVC application and then have the following minimal web.config to successfully render a Razor view:
Also what you call mess in the web.config is simply a requirement if you want to use some functionalities such as forms authentication for example. But you could add the corresponding sections progressively according to your needs. I agree that there is plenty of useless crap in the default web.config generated by Visual Studio.
您可以从空的 ASP.net MVC 3 项目开始。对于 MVC 站点来说,该站点具有最少量的起始代码/文件。您可以按照以下教程开始从空的 ASP.net MVC 3 项目创建 MVC 站点:
http://www.asp.net/mvc/tutorials/mvc-music-store-part-1
You can start with an empty ASP.net MVC 3 project. This one has the minimal amount of starting code/files for an MVC site. You can follow the below tutorial to get started on creating a MVC site from the empty ASP.net MVC 3 project:
http://www.asp.net/mvc/tutorials/mvc-music-store-part-1