views:

286

answers:

1

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

I get the error message

'Could not load typeSystem.Web.Mvc.ViewPage<blah>

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

+6  A: 

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

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

John Nelson