Visual Studio shows syntax errors in razor operators, but works

I have a project in MVC 3. It works great, and every time I create it, it succeeds. However, Visual Studio insists on showing compilation errors in views in each razor syntax. For instance:

The name "model" does not exist in the current context. D: \ ... Detail.cshtml

This line is simple:

@model Namespace.DetailViewModel

I already tried:

  • Cleaning solution
  • Cleaning and deleting folders binand obj.
  • Closing VS and reopening it (even when rebooting in the middle).

Note. I am using Visual Studio 2012.

+2
source share
2

!

, MVC 4. - ( ).

, , MVC 3 MVC 4: .

, (System.Web.WebPages, System.Web.WebPages.Razor ). , Copy Local True. , , .

+2

web.config, "", , :

<system.web.webPages.razor>
  <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  <pages pageBaseType="System.Web.Mvc.WebViewPage">
    <namespaces>
      <add namespace="System.Web.Mvc" />
      <add namespace="System.Web.Mvc.Ajax" />
      <add namespace="System.Web.Mvc.Html" />
      <add namespace="System.Web.Routing" />
    </namespaces>
  </pages>
</system.web.webPages.razor>
0

All Articles