-->

Reuse an MVC area in multiple MVC applications?

2019-03-27 21:26发布

问题:

I have some common web pages that will be in multiple MVC applications. For those pages I'd like to reuse the same source code (controllers + views) between the different MVC web sites. What is the best way to go about doing this?

ASP.NET MVC areas seem like one possibility but they just a sub directory of the website project. Is it possible to reuse an MVC area in multiple MVC applications?

回答1:

You could embed views into assemblies and implement a custom VirtualPathProvider.



回答2:

Look at "portable areas."

http://www.lostechies.com/blogs/hex/archive/2009/11/01/asp-net-mvc-portable-areas-via-mvccontrib.aspx