【问题标题】:The type System.Web.Mvc.TagBuilder exists in both librariesSystem.Web.Mvc.TagBuilder 类型存在于两个库中
【发布时间】:2013-01-22 09:38:13
【问题描述】:

我最近重新安装了我的电脑。安装 VS2010 和 VS 2012 等所有工具后,我在构建 MVC 解决方案时开始收到以下错误:

The type 'System.Web.Mvc.TagBuilder' exists in both 
'c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.WebPages.dll' 
and 
'c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET WebPages\v2.0\Assemblies\System.Web.WebPages.dll'

我使用的是 Windows 8,Web 应用程序以 .net 4 为目标。

我怎样才能消除这个冲突?

【问题讨论】:

    标签: asp.net-mvc visual-studio-2010 windows-8 visual-studio-2012


    【解决方案1】:

    在 web.config 的 <runtime> 部分添加:

      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
    

    【讨论】:

    • 对不起,我认为应该是 System.Web.Webpages 的 2.0.0.0 版本。我调整了答案。
    猜你喜欢
    • 2013-07-21
    • 2012-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多