2

I have VS2010 Premium,.NET4.0, MVC3 Tools Update.

I've nugetted microsoft-web-helpers successfully.

I cannot get @razor intellisense to recognize the microsoft.web.helpers classes.

They do work correctely at runtime, i.e. @Twitter.profile shows a profile, but at design time the statent is seen as an error and no members are shown after "."

I've tried to add

<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

to the

  <assemblies>

element in web.config, but it didn't help.

Any idea? thanks.

pomarc
  • 2,194
  • 3
  • 23
  • 30

2 Answers2

5

Try adding the following in the web.config of the Views folder under the following section. After editing this, restart Visual Studio.

  <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" />
        <add namespace="System.Web.Helpers"/> <!--This is the new entry-->
      </namespaces>
    </pages>
  </system.web.webPages.razor>
Community
  • 1
  • 1
Ahmad
  • 22,657
  • 9
  • 52
  • 84
2

I had the same problem and solved it by selecting the "Use Visual Studio Development Server" on the project Properties page.

DaveShaw
  • 52,123
  • 16
  • 112
  • 141