strange problem with mcv 1.1

Last post 07-04-2009 7:00 AM by mdn. 1 replies.

Sort Posts:

  • strange problem with mcv 1.1

    06-10-2009, 10:43 AM
    • Member
      25 point Member
    • Luca Morelli
    • Member since 11-01-2005, 8:31 PM
    • Posts 29

    hi, i installed mvc 1.1, opened an mvc project with dynamic data, converted it from 3.5 sp1 to 4.0, made the changes suggested in the release notes, and update the version number od the dynamic data from 3.5 to 4.0 that has not been updated automatically.

    i try to run the application, that worked fine with 3.5 sp1 : the first row of the index.aspx in the home controller contains

    <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IndexData>" %>
     but if i run the program i receive the error

    [InvalidOperationException: The view at '~/Views/Home/Index.aspx' must derive from ViewPage, ViewPage<TViewData>, ViewUserControl, or ViewUserControl<TViewData>.]
       System.Web.Mvc.WebFormView.Render(ViewContext viewContext, TextWriter writer) +531

    before this i had  to change all the reference like

    <%= Html.Encode(Model.UltimaSpesa)%>

    to

    <%= Html.Encode((Model as IndexData).UltimaSpesa)%>

    because seems that Model has not be handled as IndexData type, but now i have this problem.
    i'm missing something?

    best regards,
      luca morelli

     

  • Re: strange problem with mcv 1.1

    07-04-2009, 7:00 AM
    Answer
    • Member
      12 point Member
    • mdn
    • Member since 07-04-2009, 6:50 AM
    • Posts 1

    Hi Luca,

    I had the same problem, I solved editing the project (*.csprj) file changing the reference inside:

    From:

    <Reference Include="System.Web.Mvc, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

    To:

    <Reference Include="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

    The problem derives from the different version of the assembly used during compilation and runtime.

    best regards

    Marco


    Filed under:
Page 1 of 1 (2 items)