user1787270
user1787270

Reputation: 358

Mvc4 Website builds, but Error List is populated when viewing Razor files

I have an Mvc4 website that builds and runs just fine, but each Razor content page is filled with errors when viewed in VS2012. I get errors that the model keyword and ViewBag object don't exist, and Intellisense only picks up code like Html.TextBox and Html.Hidden, not Html.HiddenFor or Html.TextBoxFor.

My guess would be that nothing in the node of Web.Config is being registered by intellisense; does anyone know how to get these namespaces to properly register again?

Upvotes: 0

Views: 94

Answers (1)

user1787270
user1787270

Reputation: 358

Looks like it was a problem with no specified version in the Views/Web.config. Here's what the updated config sections look like now:

<configuration>
    <configSections>
        <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
            <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
            <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
        </sectionGroup>
    </configSections>
</configuration>

Upvotes: 1

Related Questions