MVC Sharing Arrangement on Multiple Projects


I have multiple MVC3/4 projects (in the same solution - they share an infrastructure and services project) for a number of apps. Each of the web sites needs to share the same header.

What is the easiest way to do this? Is there a way to use a _Layout.cshtml across multiple projects?

I want to avoid having one project with multiple areas because the apps are so diverse and I want to avoid deploying the entire solution every time I make a change to one of the apps.

Is there an easy way to do this?

EDIT: thought about this a bit an alternative - what about having an html helper in my infrastructure project that returns the html header? This can then be used by all projects that reference it...good idea? no?

We have this with our intranet, currently using forms. I want to change to MVC which is how I came across this post, asking the same question as you. Looking for a "nicer" way of sharing layout/header across multiple projects.

What we used to do (and may still) was to have the HTML in a database, a shared DLL that fetches that HTML mixes in variables (menus etc) and then call a build the header function.

This falls down when you update your Header.dll and you need to publish it to everywhere. It's the best solution I've found to this issue, but if it was possible to access views in a shared folder above the project, that would help immensely.