ASP.NET MVC2 DataAnnotations not catching error
Can somebody help me to figure out why DataAnnotations will not work with my MVC2 project in VS 2008 SP1? H开发者_运维技巧ere'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?
A second re-install of MVC2 seemed to get rid of this problem
精彩评论