[RESOLVED]After updating from VS2012 to VS2013, CS1061 compile error

For my MVC 4 web application, I updated 3 machines from VS2012 to VS2013, applied VS2013.4 update, ran NuGet> Install-Package Microsoft.AspNet.Mvc -Version 4.0.40804.0 -Project (project name).

The solution rebuilds with no errors.

But when I run the web site in IISExpress under the debugger, on two of the machines I get a compile error in the browser that comes up:

Compiler Error Message: CS1061: ‘object’ does not contain a definition for ‘SubMenuItem’ and no extension method ‘SubMenuItem’ accepting a first argument of type ‘object’ could be found (are you missing a using directive or an assembly reference?)

Source Error:
Line 3:  <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Line 4:      <%= this.S("JTLanguage") %> – <%= this.S(Model.SubMenuItem) %>
Line 5:  </asp:Content>

The page header is:

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

It seems that it can’t find my model class (TextViewData), though it’s namespace is referenced in the namespaces list in the"Web.config file.

If it right-click on "Model" and select "Go to definition", it brings up the non-generic ViewPage class, and not the generic version.

Any ideas on how to fix this?

Thanks.

-John

Upgrading from MVC 4.0.0.1 to 5.2.2.0 seems to have fixed it.  I initially resisted upgrading as I thought it would require lots of changes to my 100′s of views, but apparently not.  See

https://www.asp.net/mvc/overview/releases/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2

Leave a Reply