Sharing views between ASP.NET MVC 3 Web application projects

纵然是瞬间 提交于 2019-12-21 02:30:44

问题


I have several ASP.NET MVC 3 Web applications that have a lot of common objects:

  • The same login controller. The few differences between their login systems are captured in their web.config files.
  • Header/detail views: invoices, payment orders, payment orders, etc.

In order to make my code less redundant, I moved common controllers and views to a separate class library (models were already in their own class libraries). After googling for a while, I eventually found out how to call controllers in external assemblies, however, I still don't know how to call views in external assemblies. How do I do that?


回答1:


You may want to look at MVCContrib Portable areas. They allow you to compile an entire MVC application area into one assembly, including controllers, views and supporting files such as JavaScript and CSS. I've worked on a large project that made extensive use of them and they work well, especially combined with T4MVC.



来源:https://stackoverflow.com/questions/6430571/sharing-views-between-asp-net-mvc-3-web-application-projects

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