title: 'Compare' is an ambiguous reference between 'System.ComponentModel.DataAnnotations.CompareAttribute' and 'System.Web.Mvc.CompareAttribute'
body: <p>I have this error in my AccountController . </p>
  
  <blockquote>
    <p>The type or namespace name 'SelectListItem' could not be found ( are you missing a using directive or an assembly reference?</p>
  </blockquote>
  
  <p>The obvious fix is to add <code>using System.Web.Mvc;</code> However when I do I get 4 new errors</p>
  
  <p>On two difference lines:</p>
  
  <blockquote>
    <p>The type or namespace name 'ErrorMessage' could not be found (are you missing a using directive or an assembly reference?)    </p>
  </blockquote>
  
  <p>On another 2 different lines:</p>
  
  <blockquote>
    <p>'Compare' is an ambiguous reference between 'System.ComponentModel.DataAnnotations.CompareAttribute' and 'System.Web.Mvc.CompareAttribute'</p>
  </blockquote>
  
  <p>Why does this happen and how do I fix it?</p>
  
  <pre><code>public class RegisterViewModel
      {
  [DataType(DataType.Password)]
          [Display(Name = "Confirm password")]
          [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
          public string ConfirmPassword { get; set; }
         public IEnumerable&lt;SelectListItem&gt; DepotList { get; set; }
  
  
  }
  </code></pre>
  
  <p>ResetPasswordViewModel</p>
  
  <pre><code>public class ResetPasswordViewModel
  {
  
      [DataType(DataType.Password)]
      [Display(Name = "Confirm password")]
      [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
  
  }
  </code></pre>