2

I'm currently refactoring a huge ASP.NET MVC website. The main idea of what I'm trying to achieve is having a main (front) website and several separate websites in the same solution that can be deployed separately. The reason for that is that we have different teams working on a different project. The current setup looks like this:

  • Main website ASP.NET MVC
  • Module 1 (Area)
  • Module 2 (Area)
  • other modules..
  • Common Business Layer
  • Common Data Layer
  • Common View Layer

When making changes to a module, you have to deploy the main website (so although Areas are acting as separate projects, they cannot be deployed separately). Areas are using RazorGenerator for the views. The Common View Layer generates Embedded Resources to be used in the main website/modules.

Any solution for that?

What I'm trying to accomplish right now is extracting the modules from Areas into full ASP.NET MVC websites and map them in IIS as subdomains to the main website. The problem here is that I have repeating views, styles, layouts in all projects and making a change to the main menu, style, etc. would mean going through all the projects and make that same change. Not a viable option.

Thanks for the ideas!

3
  • One project == one website. If you want your current areas to be separate sites, then break them out into their own projects. You can map subdomains to areas, if that's all you're looking for, but you'll still have to deploy the whole website, including all areas in one go. There's no way to just deploy an area. Commented Mar 21, 2017 at 14:58
  • Hi Chris, Any solution to actually have separate deployable projects, but with a common view? The only solution I've found so far is creating a NuGet package for those views, styles, scripts and add it to all projects. Commented Mar 21, 2017 at 16:05
  • 1
    That's actually probably the best approach anyways. You can use Razor Generator to share views via a class library, but static resources would still be an issue. The only real option for static files would be to simply host them on a separate domain and reference them in your projects from that domain. Commented Mar 21, 2017 at 16:08

1 Answer 1

1

So the answer can depend also whether you want to have several solutions (*.sln) or it will be just one solution with several mvc projects.

Ad.1 Multiple sln / directories.

In that case probably interesting option is to configure virtual directory with some static content like styles, scripts etc. Such virtual directory can be quite easily configured on IIS: https://msdn.microsoft.com/en-us/library/bb763173.aspx

Ad.2 One solution, multiple MVC projects:

Then I'd suggest to add some solution folder like 'Common Presentation Layer Files' -> then I'd move all those files to be shared into that solution folder. Next in those MVC projects I would do following thing => right click => add existing item => as a link. As the result you'll have a copies / shortcuts to the original files. You should do the updates only in that common folder and the changes will be visible in all other mvc projects. https://msdn.microsoft.com/pl-pl/library/9f4t9t92(v=vs.90).aspx Then you can publish your MVC projects separately and if properties of those static files are ok all the files will be copied during publish. So the structure would look like:

Solution:

  • MVC App 1 (proj)
  • MVC App 2 (proj)
  • 'Common Presentation Layer Files' (solution folder)
  • other projects (projs)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.