Thursday, January 24, 2019

Error 3 'CompareAttribute' is an ambiguous reference between 'System.ComponentModel.DataAnnotations.CompareAttribute' and 'System.Web.Mvc.CompareAttribute'

Error 3 'CompareAttribute' is an ambiguous reference between 'System.ComponentModel.DataAnnotations.CompareAttribute' and 'System.Web.Mvc.CompareAttribute';Error 3;CompareAttribute is an ambiguous reference

Error:


Error 3 'CompareAttribute' is an ambiguous reference between 'System.ComponentModel.DataAnnotations.CompareAttribute' and 'System.Web.Mvc.CompareAttribute'

Cause:


This happens when running VS 11 with mvc Beta 4 and .Net 4.5.

Solution:


To make this work between .NET4 and .NET45 you need to add the below statement in those files to:

using CompareAttribute = System.Web.Mvc.CompareAttribute;

No comments:

Post a Comment