How to add using statement in mvc 5 to all views

拟墨画扇 提交于 2020-01-05 12:11:11

问题


There are many examples of adding a using statement for all views in web.config for prior versions, but I have not found one for MVC 5.

Can someone give me an example?


回答1:


Locate Web.config in the Views folder.

Find the namespace section. It will already have namespaces for Mvc.

Add the desired namespace:

<namespaces>
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Optimization"/>
    <add namespace="System.Web.Routing" />
    <add namespace="MyNamespace" />
  </namespaces>


来源:https://stackoverflow.com/questions/22382087/how-to-add-using-statement-in-mvc-5-to-all-views

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!