Question

The Scenario : I have my main base MVC project, with the model + view + controller that I want to re-use in my children MVC projects. But the children MVC projects's CSS styles are all different, and uses different localization resource files.

The question: Is it possible to create such an MVC child project that references the parent MVC project, but uses different styles etc? The only difference between the projects are the styles and localization.

Or will I have to keep the views separate in each child project? (this feels like a waste because all the projects views will have the same code)

I am using TFS, so I don't think "File Linking" is an option

Regards David

Was it helpful?

Solution 2

I only tested this briefly, but it seems to do the trick : MvcApplicationRazorGeneratorSeparateLibrary. There is a zip file you can download and test

This means you have two MVC projects, the main one creates all the views etc and compiles it. Then you can reference it from the second MVC project, and only change the styling, content, web.config or add views in the second MVC project.

OTHER TIPS

I see two ways:

  1. Calculate main css file based on domain name (or other projects differences) and use it in view where css include to HTML
  2. Create two views packs and switch it in projects (in addion you can change HTML in projects)

For example first way you may look http://www.getpets.me/ and http://www.getalljobs.com/ sites. They use one instance of code, but include different css files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top