6

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?

James Newton-King
  • 48,174
  • 24
  • 109
  • 130

2 Answers2

4

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

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • Check out https://github.com/mcintyre321/EmbeddedResourceVirtualPathProvider#readme for one such Nugettable provider – mcintyre321 Apr 06 '13 at 16:07
3

Look at "portable areas."

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

3Dave
  • 28,657
  • 18
  • 88
  • 151