【问题标题】:Error replacing System.Web.WebPages dll with my version用我的版本替换 System.Web.WebPages dll 时出错
【发布时间】:2012-05-11 02:29:51
【问题描述】:

我必须对 ASP.NET MVC System.Web.Webpages dll 进行一些更改。但是当我替换 dll 时,它会抛出这个错误。

“System.Web.WebPages.WebPageBase”类型在程序集中定义 没有被引用。您必须添加对程序集的引用 'System.Web.WebPages,版本=1.0.0.0,文化=中性, PublicKeyToken=31bf3856ad364e35'。

【问题讨论】:

    标签: asp.net-mvc-3


    【解决方案1】:

    我遇到了同样的问题,

    我最终按照here的建议解决了这个问题。

    并将以下内容添加到我的 web.config

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <!-- … -->
      <system.web>
        <!-- … -->
        <compilation debug="true" targetFramework="4.0">
          <assemblies>
            <add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
            <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
          </assemblies>
        </compilation>
        <!-- … -->
      </system.web>
      <!-- … -->
    </configuration>
    

    【讨论】:

      【解决方案2】:

      我发现引用的“System.Web.Webpages”DLL 将“本地复制”设置为 true 对我有帮助。我也必须对其他一些 DLL 执行相同的操作。

      【讨论】:

        【解决方案3】:

        当我在 TFS 中移动目录时,我也遇到了这个错误。我通过打开 NuGet 并更新所有 DLL 中引用的 MVC 框架来修复此错误。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-05-11
          • 2022-01-09
          • 1970-01-01
          • 2019-02-23
          • 2023-03-09
          相关资源
          最近更新 更多