“System.Web.Webpages.Html.Htmlhelper”不包含“Sitecore的”的定义 [英] 'System.Web.Webpages.Html.Htmlhelper' does not contain a definition for 'Sitecore'

查看:1180
本文介绍了“System.Web.Webpages.Html.Htmlhelper”不包含“Sitecore的”的定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到在Visual Studio这个错误,当我使用 @ Html.Sitecore

I'm getting this error in Visual Studio, when I use @Html.Sitecore:

System.Web.Webpages.Html.Htmlhelper'不包含'Sitecore的'和最佳推广方法重载'Sitecore.Mvc.HtmlHelperExtensions.Sitecore(System.Web.Mvc.HtmlHelper)'的定义有一些无效arguments.`

'System.Web.Webpages.Html.Htmlhelper' does not contain a definition for 'Sitecore' and the best extension methods overload 'Sitecore.Mvc.HtmlHelperExtensions.Sitecore(System.Web.Mvc.HtmlHelper)' has some invalid arguments.`

然而,一旦部署它运行没有任何问题。

However, once deployed it does run without any problems.

我使用Sitecore的7.2 MVC 5.1。

I'm using Sitecore 7.2 with MVC 5.1.

这是我读过,处理类似的错误消息的文章,谈 system.web.webPages.razor 部分浏览文件夹的web.config 文件。这是怎么出现在我的解决方案。

Articles that I've read that deal with similar error messages, talk about the system.web.webPages.razor section of the Views folder web.config file. This is how it appears in my solution.

<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>

原本我以为我只是需要重新启动VS,但没有奏效。没有任何人有任何建议。

Originally I thought I'd just need to restart VS, but that didn't work. Does anyone have any suggestions.

修改
这是标准的7.2 Sitecore的安装等方面具有以下绑定重定向:

EDIT This is the standard Sitecore 7.2 installation, and so has the following binding redirects:

  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" xmlns="urn:schemas-microsoft-com:asm.v1"/>
    <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.1.0.0" xmlns="urn:schemas-microsoft-com:asm.v1"/>
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" xmlns="urn:schemas-microsoft-com:asm.v1"/>
    <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" xmlns="urn:schemas-microsoft-com:asm.v1"/>
  </dependentAssembly>

也正在从Visual Studio输出时,有一个附加的错误,我没有发现前:

Also when looking at the output from visual studio there is an additional error that I didn't spot before:

实例参数:无法从System.Web.WebPages.Html.HtmlHelper'到'System.Web.Mvc.HtmlHelper

编辑2

我不再认为这是一个Sitecore的MVC问题。我得到 @ Html.ActionLink类似的错误(XXX,XXX)。其他人都看到了在VS2012这个问题,但是我使用2013。

I no longer think this is a Sitecore MVC issue. I get a similar error with @Html.ActionLink("xxx", "xxx"). Other people have seen this issue in VS2012, but I'm using 2013.

编辑3

有相当现在对这个问题的几个答案。我建议尝试他们每个人,因为它似乎有可能出现此错误的原因很多。

There are now quite a few answers to this question. I recommend trying each of them as it seems there are numerous reasons this error might occur.

推荐答案

我现在已经解决了这个问题。我只是不得不安装Visual Studio 2013的更新2如何令人沮丧。

I have now resolved this issue. I simply had to install Update 2 of Visual Studio 2013. How frustrating.

由于StriplingWarrior和Ahmed Okour你有用的建议。

Thanks to StriplingWarrior and Ahmed Okour for your useful advice.

这篇关于“System.Web.Webpages.Html.Htmlhelper”不包含“Sitecore的”的定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆