[英]Sharing views between ASP.NET MVC 3 Web application projects
I have several ASP.NET MVC 3 Web applications that have a lot of common objects: 我有几个具有许多常见对象的ASP.NET MVC 3 Web应用程序:
web.config
files. web.config
文件中。 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?
我怎么做?
You may want to look at MVCContrib Portable areas . 您可能需要看一下MVCContrib Portable区域 。 They allow you to compile an entire MVC application area into one assembly, including controllers, views and supporting files such as JavaScript and CSS.
它们使您可以将整个MVC应用程序区域编译为一个程序集,包括控制器,视图和支持文件(如JavaScript和CSS)。 I've worked on a large project that made extensive use of them and they work well, especially combined with T4MVC .
我参与了一个大型项目,该项目广泛使用了它们,并且效果很好,尤其是与T4MVC结合使用时 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.