在TeamCity中构建时找不到CompareAttribute(在Windows Server 2012 RC上)

big*_*7bb 2 teamcity windows-server asp.net-mvc-3

我正在尝试在安装在Windows Server 2012 RC服务器上的TeamCity上构建一个MVC项目.

我收到以下错误.它看起来像MVC版本的某种冲突,如果我一直在谷歌搜索时发现的.我正在通过版本明确地引用system.web.mvc等,所以我不知道问题是什么.有任何想法吗?

Models\AccountModels.cs(26, 10): error CS0246: The type or namespace name 'Compare' could not be found (are you missing a using directive or an assembly reference?) 
Models\AccountModels.cs(26, 10): error CS0104: 'CompareAttribute' is an ambiguous reference between 'System.ComponentModel.DataAnnotations.CompareAttribute' and 'System.Web.Mvc.CompareAttribute' 
Models\AccountModels.cs(64, 10): error CS0246: The type or namespace name 'Compare' could not be found (are you missing a using directive or an assembly reference?) 
Models\AccountModels.cs(64, 10): error CS0104: 'CompareAttribute' is an ambiguous reference between 'System.ComponentModel.DataAnnotations.CompareAttribute' and 'System.Web.Mvc.CompareAttribute' 
Run Code Online (Sandbox Code Playgroud)

VJA*_*JAI 10

您必须在Compare属性中明确指定名称空间

[System.Web.Mvc.Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
Run Code Online (Sandbox Code Playgroud)

代替

[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
Run Code Online (Sandbox Code Playgroud)