构建错误 - 'System.Web.Mvc.ModelClientValidationRule'冲突

Pau*_*own 23 asp.net-mvc visual-studio asp.net-webpages

我试图在VS2010中"构建"我的MVC3 Web应用程序但是不断收到以下错误:

错误2'c:\ Program Files(x86)\ Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll'和'c'中存在类型'System.Web.Mvc.ModelClientValidationRule' :\ Program Files(x86)\ Microsoft ASP.NET\ASP.NET Web Pages\v2.0\Assemblies\System.Web.WebPages.dll'C:\ Users\brownp\Documents\Visual Studio 2010\Projects\Cab \驾驶室\型号\ AccountModels.cs 223 28驾驶室

此外,每次打开解决方案时,它都会提示我以下内容:

打开解决方案时VS2010错误

我通过Web Platform Installer安装并成功安装,但每次打开解决方案时都会重新显示该消息.

有人可以提供任何指导吗?

谢谢保罗

Tom*_*kel 44

今天安装MVC4测试版后,我的一些MVC 3项目无法编译.(ModelClientValidationRule冲突)修复是:

编辑:

ProjectName.csproj
Run Code Online (Sandbox Code Playgroud)

更改

<Reference Include="System.Web.WebPages"/> 
Run Code Online (Sandbox Code Playgroud)

<Reference Include="System.Web.WebPages, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL "/>
Run Code Online (Sandbox Code Playgroud)


bot*_*bot 13

好的尝试此解决方案......

  1. 在根Web.config文件中,添加一个包含密钥webPages:Version和值1.0.0.0的新条目.

    <appSettings>
    <add key="webpages:Version" value="1.0.0.0"/>
    <add key="webpages:Version" value="1.0.0.0"/>
    <add key="ClientValidationEnabled" value="true"/>
    <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
    </appSettings>
    
    Run Code Online (Sandbox Code Playgroud)

2.In Solution Explorer, right-click the project name and then select Unload Project. Then right-click the name again and select Edit ProjectName.csproj.

3.Locate the following assembly references:

    <Reference Include="System.Web.WebPages"/>
    <Reference Include="System.Web.Helpers" />
Run Code Online (Sandbox Code Playgroud)

用以下内容替换它们:

<Reference Include="System.Web.WebPages, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL "/>
<Reference Include="System.Web.Helpers, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL "/>
Run Code Online (Sandbox Code Playgroud)

4.保存更改,关闭正在编辑的项目(.csproj)文件,然后右键单击该项目并选择"重新加载".

参考:http://forums.asp.net/t/1723108.aspx/1

也尝试:http://www.asp.net/learn/whitepapers/mvc4-release-notes#_Toc303253815


Max*_*mov 10

System.Web.WebPages从解决方案引用中删除 这是全部了.