VS2010安装MVC3以后项目debug报错
错误:Error 1 The type ‘System.Web.Mvc.ModelClientValidationRule’ exists in both ‘c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v2.0\Assemblies\System.Web.WebPages.dll’ and ‘c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll’ c:\users\derek\documents\visual studio 2010\Projects\MvcApplication1\MvcApplication1\Models\AccountModels.cs 242 28 MvcApplication1
解决办法:更改文件目录下的 工程名.
.csproj,将
<Reference Include="System.Web.WebPages"/>改为
<Reference Include="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL "/>
事实上,还可以修改项目模板,地址在这里:C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache\CSharp\Web\1033\MvcWebApplicationProjectTemplatev3.0.csaspx.zip\MvcApplication.csproj
这样,以后再创建基于该模板的mvc3项目就不用每次都改了。