ASP.NET MVC2 DataAnnotations not catching error

Posted by Paul Connolly on Stack Overflow See other posts from Stack Overflow or by Paul Connolly
Published on 2010-04-17T02:17:00Z Indexed on 2010/04/17 2:23 UTC
Read the original article Hit count: 382

Filed under:
|

Can somebody help me to figure out why DataAnnotations will not work with my MVC2 project in VS 2008 SP1? Here's the situation..

I uninstalled VS2008 and MVC1, then reinstalled VS2008 SP1 and .NET 3.5 SP1 and MVC2.

Now when I create a clean project as soon as it has to hit the DataAnnotations Dll (e.g. say when I go to Register.aspx it fails at the first "LabelFor" that it encounters.

I can overcome this by changing the "Copy Local" property of the dll to True but this then creates a conflict with the same dll in the Tests project.

If then I delete the test project and try agan, it runs but does not catch any validation failures.

I have gone right back to basics and followed the step by step ScottGu Datavalidation tutorial at : http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx

And at the "Et viola" bit where we usually go "Whoa! cool!" I say "It never caught!".

Any Ideas?

© Stack Overflow or respective owner

Related posts about mvc

Related posts about dataannotations