views:

32

answers:

1

Hi, dear

I am working on my CMS project based on ASP.Net MVC2, I have implemented my VirtualPathProvider and VirtualFile for my master page, to use a master page in db.

It works as below: I indicate the MasterPageFile in the aspx/ascx file.

<%@ Page MasterPageFile="/Content.master"

Then override VirtualPathProvider.GetFile to load the master page from db, "/Content.master" is the key to search in the db.

Everything works fine for me, except

IF I click "Build Web Site" in the context menu in VS2010, I will get an error says "The file '/Content.master' does not exist."

My master page is stored in db and this error is normal, Is there a way that VS2010 can ignore this error?

I am looking into the BuildManager relative code, seems complicated.

Thank you for any help

A: 

I have found another way to avoid using MasterPageFile property

Add a custom property PageTemplate in System.Web.Mvc.ViewPage/ViewMasterPage derived classes

Jerry
Could you provide some more details? This doesn't seem to do the trick for me : I get an error: Type 'System.Web.Mvc.ViewPage' does not have a public property named 'embeddedmasterpagefile'
Bertvan