22

I upgraded to Asp.net MVC 3 RC last night and I followed the instructions on the release notes. However, normal Aspx pages no longer work.

For example, when I go to the root (Home/Index), the following error occurs:

The view at '~/Views/Home/Index.aspx' must derive from ViewPage, ViewPage<TModel>, ViewUserControl, or ViewUserControl<TModel>.

This is using a barely modified version of the original MVC Home/Index view. The code is:

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

<asp:Content ID="indexTitle" ContentPlaceHolderID="TitleContent" runat="server">
    Home Page
</asp:Content>

<asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server">
    <h2><%= Html.Encode(ViewData["Message"]) %></h2>
    <p>
        <%= Html.ActionLink("Project List", "List", "Project", new { area = "writing" }, null) %>
    </p>
</asp:Content>

It is setup to inherit from ViewPage, so I'm not sure what the issue is.

The master page is unmodified from what MVC installs.

Any ideas?

Kara
  • 6,115
  • 16
  • 50
  • 57
KallDrexx
  • 27,229
  • 33
  • 143
  • 254
  • i also upgraded last night, had no problems. take a look at this thread: http://forums.asp.net/p/1593209/4041505.aspx (maybe one of those solutions will work for you). Can you show your Controller code where your rendering the View? (unless its the default one, then don't worry) – RPM1984 Nov 11 '10 at 23:30
  • It's the default home controller code. All code I have written (except for the link in the view) resides in my own areas. I'll check out that link though. – KallDrexx Nov 11 '10 at 23:53
  • Nope nothing from that link worked :( – KallDrexx Nov 12 '10 at 00:12

1 Answers1

28

make sure you web.config has

<assemblies>
    <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <add assembly="WebMatrix.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  </assemblies>

and this

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>
</assemblyBinding>

as well as in any Areas/Web.config

Update them as needed and you should get to a better place

Phil Strong
  • 1,014
  • 9
  • 11
  • What`s the heirarchy that the `` node goes in? (e.g. System.Web, controls, etc...) – KallDrexx Nov 12 '10 at 21:55
  • Not sure what the core of the issue is, but I reverted back and re-attempted my update, and now everything is working good. I'm marking this as the answer because those configs are good to know! – KallDrexx Nov 12 '10 at 22:10
  • Thanks KallDrexx! Yeah creating a new mvc project is the easiest way to do it but I had a fairly large project I didn't want to do the copy paste shuffle on. – Phil Strong Nov 18 '10 at 15:18