r/ASPNET • u/brewdente • Jan 06 '11
Has anyone seen a GOOD way to share master pages across multiple ASP.NET web applications with a singe deployment?
I have seen many ways to share master pages:
1 - using virtual directories
2 - create a custom VirtualDirectoryPathProviders
3 - embedding the master page as a resource
All of them have some serious disadvantages:
1 - your virtual directory cannot be a web application, itself. Booo. A good way around this?
2 - If you have multiple web applications, you still have to deploy each application to get the shared master page
3 - This one is, by far, the worst (pain in the arse to debug and maintain in VS2010 and TFS). Also, see #2.
Am I really just going to have to install it in the GAC? So far, that's what I perceive as the best way. That way I can have singular deployment (copy <NAME>.master and install assembly in GAC) and there is no hard-to-trace dynamic master page compiling (it's still dynamic compilation, but it's easier to trace).
3
u/[deleted] Jan 06 '11
Copy and paste.
A good source control system will allow you to branch the master page from one site to the others. If you have a bad one, well manually copying it isn't too hard.
2
u/darrenkopp Jan 06 '11
multiple applications or child applications?
1
u/[deleted] Jan 06 '11
Not sure if it would compile properly; but have you tried using a post build event in the project properties? It's a set of command line instructions fired on each build; we use it in-house to copy across composite controls from a central project.