I have the following model:
public class Product
{
[HiddenInput(DisplayValue = false)]
public int ProductID { get; set; }
[Required(ErrorMessage
I had the same problem.
It turned out I had version 5.2.2.0 of System.Web.Mvc in the project that contained the model and 5.2.0.0 of it in the web application project.
To install the correct version you need to run the following in NuGet package mananger:
install-package Microsoft.Aspnet.Mvc ProjectName -version X
replacing ProjectName with the name of your project and X with the version you need to install.
For example:
install-package Microsoft.Aspnet.Mvc TestProject.Web -version 5.2.2.0
If you omit the version number, NuGet will simply download and install the latest version.
Once I had done this, I also needed to update my unit test project to be on the same version as the web application project. You may need to do the same.