开发者

MVC Portable Areas not working with Typed views

When using MvcContrib Portable Areas I can't get the strongly typed views to work.

I get the error message

'Could not load 开发者_如何学CtypeSystem.Web.Mvc.ViewPage<blah>

I've tried with built in types to check if it's an error with my type.


I also ran into this problem. Consuming applications need to have the following configuration in their web.config

<pages 
     pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" 
     pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" 
     userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
       <controls> 
            <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" /> 
       </controls> 
</pages>

I found you actually need these settings in a web.config within your PortableArea's project. Without these settings, your PortableArea won't be able to resolve System.Web.Mvc.ViewPage<> and causes all sorts of crazy things to happen in the IDE. The first thing that tipped me off was that I had no intellisense for <%= Html. Then, I ran my consuming project and got a yellow screen of death:

alt text http://www.freeimagehosting.net/uploads/55542d2c51.png

Found the answer to this problem on Ben Hall's blog. Hope that helps.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜