0

We have a single ASP.net MVC solution. It currently has over 50 individual projects, and quickly growing. This is causing us slow compile times, laggy Visual Studio, and pulling down from source control is taking several minutes.

These projects are split into MVC areas by department (e.g. HR, Payroll, Admin, etc) and routed accordingly (e.g. /HR/Recruitment, /Payroll/Payslips).

Here is our current structure:

 - Core web (authentication, menus, helpers, scripts, etc).    
 - Core libraries (mostly for Core web, database connections, types, etc). 
 - Areas   
         - HR
          - Recruitment
             \ Web
             \ Libraries 
          - Insurance
             \ Web
             \ Libraries 
         - Payroll  
          - Payslips
             \ Web
             \ Libraries  
         - [Etc.]    

We would like to split the areas into completely different solutions. So when you're working on HR, you only need to open HR's projects.

The problem we're having is, Core web. Currently the areas are using MVC's templating (shared layout) to draw the menus, and we're using filters contained in the core part to check for authentication.

We can turn the core part into a .dll and reference it in the areas, but MVC won't render a Razor view in the core web from an area (and while extensions do exist, they aren't officially supported). Plus we have a bunch of scripts in the core web which we'll have to figure out a way to redistribute (so we don't wind up with incompatible JQuery versions in every single solution).

Has anyone got experience with this? Utilizing MVC areas until the solution outgrew them and then had to restructure? How did you get core services into your now individual MVC solutions without massive code duplication?

Safari Jones
  • 470
  • 1
  • 4
  • 13
  • You can use a VirtualPathProvider to render views embedded in a library. See http://stackoverflow.com/questions/7746253/using-custom-virtualpathprovider-to-load-embedded-resource-partial-views –  Dec 07 '15 at 19:14

1 Answers1

1

Turn your core projects into Nuget packages. This will give you both an easy way to add them to other projects in different solutions and seamless version management. You can host your own private Nuget repository, so making them public at the official Nuget site is not a requirement.

As for your views, use Razor Generator to compile them in your class library(ies) and access them in your other projects.

Chris Pratt
  • 232,153
  • 36
  • 385
  • 444