2012-07-12 1 views
2

Windows Server 2012 RC가 설치된 서버에 Teamcity에 MVC 프로젝트를 빌드하려고합니다.TeamCity (Windows Server 2012 RC)에서 빌드 할 때 CompareAttribute를 찾을 수 없습니다.

아래 오류가 나타납니다. 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' 

답변

10

명시 적

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

대신

처럼 Compare 속성에 네임 스페이스를 지정해야
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")] 
+0

또한 VS2012로 업그레이드 한 후이 문제를보고 시작하여 프로젝트 대상이 변경되었습니다. – shannon

-1

당신은 또한 추가 할 수 있습니다

using System.Web.Mvc; 

를 상단에 의 .cs 파일

0

내 사이트를 MVC 프레임 워크 4에서 4.5.1로 업데이트했으며 (NuGet 명령 줄을 사용하여 다양한 라이브러리를 업데이트 한 후) 동일한 오류가 발생했습니다. 이미 'System.Web.Mvc를 사용하여 네임 스페이스에 대한 호출이 있습니다.' 내 .cs 파일의 맨 위에. 이 작업을 수행 할 때만 전체 경로 'System.Web.Mvc.Compare'를 사용했을 때였습니다.

0

헤더에서 System.Web.Mvc를 사용하여 제거

관련 문제