views:

84

answers:

2

I have a big .net mvc 2 project where we are using MvcContrib Portable Area. There is a main web site which load many modules (PA modules).

The main application contains Site.Mater into its ~\Views\Shared folder. each module also has own Site.Master which inherit from that main one.

At the moment we are using something like:

<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" MasterPageFile="~/Views/Shared/Site.Master" %>

After compilation the view handle the main Site.Master right as it is a relative path. Now I've received a requirement to build views during the compilation. So I've enabled MvcBuildViews = true in each web PA module project.

Of course, I'm getting errors saying "/temp/Views/Shared/Site.Master is not found".

How to keep Portable Area with content embedded and ensure that views do not contain errors?

Any idea?

+2  A: 

You can't.

I'm dealing with this same issue and you can't fake the physical location of a file easily.

The only solution is to make a placeholder and removing the non-embedded placeholder file as part of the build process. The benefit of this technique is the non-embedded resource will load a bit faster in development.

Another thing to consider is that loading your views as embedded resources is pretty slow. Having your build process move the centralized "common" views up to the local project will result in better performance for your users.

jfar
+1  A: 

in case you just want to make sure that everything works fine you could use Watin and write some unit tests that are going to check this

Omu