3

Looking for the best practice when having multiple web applications within one ASP.NET "site" or "solution". I have a few options I am toying with:

  1. old faithful of putting all applications and Site master into one Solution / one web application

  2. My boss is worried about having 30 'applications' that are all under the same project in VS and every time we make a change to one have to deploy to all. So this makes us want to break out each into a separate project under the same solution. This makes us have to look into Master page solutions

    • Master page needs to support dynamic menu structure. Is this something that I can do with a single SiteMaster? Does VirtualProvider provide the right solution for this? Anyone have any good tutorials on it?
  3. Creating a UserControl for each application and reference it in the main application

David Gardiner
  • 16,892
  • 20
  • 80
  • 117
gcoleman0828
  • 1,541
  • 3
  • 30
  • 49
  • I think your are mixing two issues here. One is how to structure your projects when there are multiple web applications in one WebSite? Second is How to support Dynamic Menu based on the heirarchy? Is that correct? – sajoshi Aug 18 '11 at 06:56
  • sajoshi- possibly, but i think one will point the other in the right direction as there are many ways to make the menu dynamically, so i would think that my initial question on application and Master pages structure (mainly master page structure0 would dictate the latter – gcoleman0828 Aug 18 '11 at 14:13

2 Answers2

3

I asked two similar questions here:

Cross-Project Master Page

Best bet is separate projects under a single solution and use Nuget package to synch up the common artifacts, including master pages. Right now this is working fine on a 22 project solution I'm working on. You can also store the Nuget package itself in source control.

Update:

You could use an XML file for your menu and share it out with Nuget. Possibly add jQuery for a sliding effect, etc.

Community
  • 1
  • 1
IrishChieftain
  • 15,108
  • 7
  • 50
  • 91
  • it seems like Nuget is very awkward to set up? – gcoleman0828 Aug 18 '11 at 03:25
  • Not at all. There's also a Nuget Explorer tool in the download. You can make it as simple as you wish. Try solution with two test projects to get started; your main task will be to package the common files :) – IrishChieftain Aug 18 '11 at 04:15
  • CAn you point me to or give me an example of using this? it looks like you are only publishing dlls here, if i'm doing that isn't a virtual directory easier? – gcoleman0828 Aug 18 '11 at 12:48
  • Create a base project which defines site template. Add all common files needed by other projects to package (master, css, images, scripts, etc). Use Nuget to push these common files out to the other projects. – IrishChieftain Aug 18 '11 at 13:41
  • Ok, i watched something on Nuget, but it seems like it is a project packager and is not used for this? If i make a project and use Nuget to create a package and add the dll that is referenced for the site master, won't i have to re publish every application? Seems like this will cause more work rather than less for the same results? – gcoleman0828 Aug 18 '11 at 14:21
  • It's not a "project packager"; you can package anything. Keep master the same and try it out with a test solution of two projects. This is working for me. – IrishChieftain Aug 18 '11 at 14:46
1

1) So this makes us want to break out each into a separate project under the same solution.

(Good idea)

Master page needs to support dynamic menu structure.

As a side note, Have you ever heard of MEF?
This is pretty suitable for your case.
Using it, you can have a full extensible master page solution with ability to add extra menus (and functionality for each) on the fly!!!.
By MEF technology you can have separate project under a single solution. Every (new/updated) project can be

  • Published / Republished.
  • have it's content files merged with the main already published site (master project)
  • Copy generated dll of the child project into bin folder
  • Restart the site.

here are some paper about it: Microsoft reference, CodeProject basics for Asp.Net
There is also a concept named Portable Area. But i don't know about how it works or what exact scenario it covers or even if it is applicable for Asp.Net or only for Asp.Mvc. just give it a try if interested.

Rzassar
  • 2,117
  • 1
  • 33
  • 55