错误:无法加载文件或程序集'System.Web.Mvc,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一

时间:2014-06-20 12:37:57

标签: asp.net-mvc-4 sitecore sitecore7 glass-mapper

我希望我的字段可以在sitecore中编辑(支持页面编辑器)。我使用MVC 4.0和Glass Mapper来映射字段。 阅读文章Page Editing in MVC后,我使用了

 @inherits Glass.Mapper.Sc.Web.Mvc.GlassView<My Model Class>

在我的部分视图中获取&gt; @Editable但是当我使用inherits关键字时,我的页面会出现以下错误消息

Error: Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference

有人可以建议如何使用@Editable关键字在Sitecore中使用MVC 4.0和Glass Mapper版本3.0.10.23编辑我的字段。 其他版本

Glass.Mapper.Sc版本 - 3.2.0.39

Glass.Mapper.Sc.Mvc version - 3.2.0.34

我的视图如下所示

@using Sitecore.Mvc
@using Test.Libraries.Sitecore.Glass.Mapper.Common;
@inherits Glass.Mapper.Sc.Web.Mvc.GlassView<Test.Libraries.Sitecore.Glass.Mapper.Common.Footer>

   <h2>@Editable(x=>x.Title)</h2>

 View which works is

@using Sitecore.Mvc
@using Test.Libraries.Sitecore.Glass.Mapper.Common;
@model Footer

   @Model.PageTitle

请建议。感谢

1 个答案:

答案 0 :(得分:1)

尝试从MVC 3添加绑定重定向 - &gt; MVC 4 ......

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers"
             publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc"
             publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="4.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages"
             publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

添加到您的网站项目的web.config(假设可以使用sitecore?)。