I am trying to set up an MVC3 solution using areas, but I want to have my areas in different assemblies. For example, I want a parent assembly that contains shared resources like master pages, style sheets, scripts, login page, etc. But I want distinct areas of business functionality in separate assemblies.
I tried this sample that was written for the MVC2 preview: http://msdn.microsoft.com/en-us/library/ee307987%28VS.100%29.aspx. (Note, I originally found this from this Stack Overflow thread: ASP.NET MVC – separating large app). But it appears that MVC3 does not have the option to move view files into the main project. Iām not crazy about using the embedded resource / VirtualPathProvider option.
Any suggestions on how to make this work with MVC3?
Thanks,
Skip
Best Answer
1 - Seperate you Mvc Areas into differrent Mvc Projects to be compiled into their own seperate assemblies
2 - Add this to your AssemblyInfo.cs class, to call a method when the application is loaded
3 - Here's what the Init method looks like when it's invoked during the load
4 - Add a custom RazorViewEngine
5 - Register your Areas from your different Mvc (Area) Projects
Sourcecode and additional references can can be found here: http://blog.longle.io/2012/03/29/building-a-composite-mvc3-application-with-pluggable-areas/