tags:

views:

171

answers:

3

I want to put my master pages in a central library so I can use them in several projects without having the maintanance nightmare. Everything is refactored in a generic and central way, they are all in a "shared" namespace. But if put them in a seperate project, I can't reference them

+1  A: 

I don't believe you can put that actual .master pages in an external library. You can place your own customer MasterPage-derived class in the library, and have your client apps derive from that, but I don't think that's what your intent is, since you're tagged with asp.net-mvc (implying very narrow views without much logic, and probably no code-behinds).

As far as I'm aware, there isn't a way to reference a master (nor, for that matter, an ASPX or ASCX) from an external library. Wish I had better news for you. (And I actually hope I'm wrong; I hope someone else here has figured out a technique for this, as I'd like to use that kind of thing myself on occasion.)

John Rudy
that _is_ sad news
borisCallens
A: 

Just for reference's sake, I'll put Phil's mail here too:

Sorry for the late response. You could try using a VirtualPathProvider, but this would require full trust. Other than that, I don't know of any way to do this.

Phil

so there you go.

borisCallens
A: 

Also I need. I need a compile master page into Class Library (dll) and then reference it in page onpreinit But I can not set master page type of page. (I can set MasterPageFile which must be a virtual url on web not a type)

hassan