Error throws using ModelClientValidationRule in MVC 5?

I'm trying to do custom client-side validation in an MVC 5 project. When I add the following code:

 public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
 {
    //Some Validation Here
 }

I get the following error:

Could not find type name 'ModelClientValidationRule'. This type was sent to the assembly "System.Web.WebPages, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35." Consider adding a link to this assembly.

But when I check the file web.config, I use the version of WebPages supported by 0.0

<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
   <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
+4
source share
1 answer

System.Web.Mvc , , , . , System.Web.Mvc [3.0.0.1], , System.Web.Mvc [4.0.0.1]. , , System.Web.Mvc [4.0.0.1] System.Web.Mvc [3.0.0.1].

0

All Articles