错误:
错误2类型“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”中E:\Tmp\mvc\MvcMusicStore-v2.0\MvcMusicStore-v2.0\MvcMusicStore-Completed\MvcMusicStore\Models\AccountModels.cs24328MvcMusicStore
解决办法:
可以如下修改,保持兼容性:
(1)修改 Web.config。增加key为webPages:Version并且value为1.0.0.0的节点,即:
<appSettings>
<addkey="webpages:Version"value="1.0.0.0"/>
<addkey="ClientValidationEnabled"value="true"/>
<addkey="UnobtrusiveJavaScriptEnabled"value="true"/>
</appSettings>
(2)修改 ProjectName.csproj。(直接用记事本打开)
搜索:
<ReferenceInclude="System.Web.WebPages"/>
<ReferenceInclude="System.Web.Helpers"/>
替换为:
<ReferenceInclude="System.Web.WebPages, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL "/>
<ReferenceInclude="System.Web.Helpers, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"/>