views:

62

answers:

2

Hi guys.

Im currently developing an application with two web projects (MVC):

  • Frontend
  • Backend

These two are going to have almost the same layout (few minor changes). Therefore I thought about creating a MasterPage, they can share. But since it's two projects in two different locations, where should I put the masterpage, images and javascript?

The images and javascript (static stuff), could be placed on a CDN.

But how 'bout the ASP.NET specific stuff? Any suggestions? Any help appreciated!

A: 

It's possible to include an existing file from another project in a new project. You can do that. So just put it in one project and include it in the other.

Alternatively, you can create a 'core' library, and put things in there, but that doesn't 'play' well with controls and so on, so I'd recommend the first approach.

Noon Silk
You can? How? But that doesn't like the best solution for me, since the page is placed in one of the projects, not seperated from each of the projects. Maybe the 'core' project is the way to go. Hmm.
Kordonme
+1  A: 

A MasterPage is a UserControl under the hood, so any method of sharing UserControls would work for MasterPages. Unfortunately this isn't that great of an experience in ASP.NET as the BuildManager (what compiles and connects the app paths to classes during build-time) only recognizes & processes files within the current project.

Sharing code-behind, or base classes is easy and works well. It is the design surface (.master, .ascx, .aspx) that doesn't have a lot of ability to be shared. You can use a deployment project to compile a web app project into an Assembly that can be referenced, but you will still need some design files in your actual project.

This might also be of help:

McKAMEY