views:

55

answers:

2

Given multiple websites all running the same sourcecode, what's the best/most maintainable way to organise these into projects within visual studio?

For example, say we have websites Red, Blue, and Green (etc). Their HTML may be different, but they are a functionally the same.

Previously in one solution we have created one project Colour, which contains a generic version of the project. Red, Blue, and Green get their own project, and each technical page is set to use the C# in Colour. (That is, there's no unique C# for the individual implementations - all code files get removed).

However, this approach leads us to ending up with multiple individual implementation dll's that do next to nothing, and also Other Stuff like javascript, css, and common images get duplicated accross projects.

Ideally we'd like to be able to run each project in isolation, and sourcesafe sharing always seems like a terrible idea.

Is there a Better Way?

edit: forgot to mention, all business logic / data access is handled by a shared Business Layer project, so all the code for that is separate and shared.

+2  A: 

Pack the shared code into a class library. That'll take care of the data layer, business logic and some other auxiliary routines. My experience is that it helps a great deal with projects having the same foundation.

Your projects Red, Green and Blue, if they are different then they have to be kept apart. You can't really circumvent that. My personal approach is to immediately introduce a change made in one into all others before you forget it. That has worked fine for me.

Developer Art
Thanks for the input, forgot to mention that they do all have a shared business layer, so all the business logic is in one place - I'll update the question a little.
Zeus
+1  A: 

I would recommend you using the MVP pattern with ASP.NET. This way you could have a single class library project containing the models and the presenters which would be referenced by multiple ASP.NET applications containing the views and of course static resources such as JS, CSS, images which could be specific to each site. Of course if you want to share static resources between web applications you could put them into a common location so that they are referenced from there (like SO does with sstatic.net).

So your solution could look like this:

NameOfProject.sln
    |
    |-- NameOfProject.Presenters
    |
    |-- Web Application 1
    |
    |-- Web Application 2
  .....
    |-- Web Application n
Darin Dimitrov