zoukankan      html  css  js  c++  java
  • 同时安装vs2010和VS2012后IEnumerable<ModelClientValidationRule>编译错误

     今天安装了VS2012后,发现原来的一个MVC项目编译时发生错误,具体错误信息如下:

    错误    4    类型“System.Web.Mvc.ModelClientValidationRule”同时存在于“c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v2.0\Assemblies\System.Web.WebPages.dll”和“c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll”中    

    查阅一些资料后,解决方法如下:

    Step 1

    修改Web.config,在  <appSettings>新增<add key="webpages:Version" value="1.0.0.0"/>

    1   <appSettings>
    2     <add key="webpages:Version" value="1.0.0.0"/>
    3   </appSettings>


    Step 2

    关闭解决方案

    用记事本打开 项目名称.csproj

    找到

    1 <Reference Include="System.Web.WebPages"/> 
    2 <Reference Include="System.Web.Helpers" />

    改成

    1     <Reference Include="System.Web.WebPages, Version=1.0.0.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL "/> 
    2     <Reference Include="System.Web.Helpers, Version=1.0.0.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />

    保存,OK。现在再重新打开编译一下试试。

  • 相关阅读:
    poj 3616 Milking Time
    poj 3176 Cow Bowling
    poj 2229 Sumsets
    poj 2385 Apple Catching
    poj 3280 Cheapest Palindrome
    hdu 1530 Maximum Clique
    hdu 1102 Constructing Roads
    codeforces 592B The Monster and the Squirrel
    CDOJ 1221 Ancient Go
    hdu 1151 Air Raid(二分图最小路径覆盖)
  • 原文地址:https://www.cnblogs.com/yexinw/p/2779906.html
Copyright © 2011-2022 走看看