Enterprise Library – StringLengthValidator [Validation Attribute] is not an Attribute Class

If you are trying to use Enterprise Library 5.0 Validation Application block and are seeing an error in visual studio when you add the StringLengthValidator attribute to a property you want to be validated then you need to add a reference to System.ComponentModel.DataAnnotations assembly to your project. This is needed in addition to the Mircrosoft.Practices.EnterpriseLibrary.Validation assembly you would normally add. This is mentioned in the Entlib 5.0 Breaking changes.
“If you used validator attributes in your code you must now reference the System.ComponentModel.DataAnnotations assembly.” Too bad I didn’t read it and spend quite some time figuring this out. The System.ComponentMode.DataAnnotations namespace gives access to attribute class that are used to define the metadata for the validators.