Deploying Multiple Sites on the Same Codebase - Asp.Net, C#, MVC
I recently inherited a solution with about 10 projects in it. 6 of these projects are individual websites that are basically copy/pastes of the original.
This means that any changes that need to be made must be made to each project in or开发者_JAVA技巧der to update all the websites.
What I want to do is have one project for the website code and be able to deploy that code and some configuration settings to create a new website. That way when I make updates to the main Web project I can just deploy to all the websites.
How do people normally approach this? I'll outline my thoughts on it and hopefully some of you can point out better ways to accomplish this or at least give me some affirmation that I am on the right track.
- Have a master markup with very general containers.
- Allow the users/people setting up the site add widgets to the site which will be assigned to widget placeholders at the top and bottom of all the generic containers.
- All styling and colors will be controlled with a stylesheet that can be swapped out.
- I know there is some kind of theming you can do. Does this just swap out groups of css and let you configure which one to use in the webconfig?
- For elements that will be the same across all sites such as footer images have a naming convention. So if I want Site A to have some footer image I just replace the footer.jpg in the project when I deploy.
Your approach is good.
- You should use master markup
- Your web system will be CMS
- You can use themes to define styles of different projects or you can link css files dynamically
- if they are really copies of each other than you can make it very general by defining all of them as one website and put all the settings of css images markups in database
- If you don't want to make everything very generic you can make web user controls and load them dynamically at run time according to the project (Remember, you can load
WebUserControls
at runtime using theLoadControl
method)
That's unfortunately a question that is likely to get the response 'It depends' as each of those approaches could be used or not used dependent on the needs of the project. If the projects only vary by presentation then master pages combined with CSS would make a reasonable solution.
精彩评论