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开发者_如何学JAVA=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
to the
<assemblies>
element in web.config, but it didn't help.
Any idea? thanks.
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>
I had the same problem and solved it by selecting the "Use Visual Studio Development Server" on the project Properties page.
精彩评论