开发者

Compile views with enabling MvcBuildViews into MVC 2 Portable Area

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?


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜