This is my model:
namespace MvcApplication2.Models
{
public class CreditCard
{
[CreditCard(ErrorMessageResourceType = typeof(Messages), Error
It's a known issue in .Net 4.5. Adding "ErrorMessage = null" named parameter should solve this.
Reference:
Reference link is broken now.
http://connect.microsoft.com/VisualStudio/feedback/details/757298/emailaddress-attribute-is-unable-to-load-error-message-from-resource-mvc
[CreditCard(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "CardNumberInvalid", ErrorMessage = null)]
Adding the ErrorMessage = null
will fix your problem.