I am trying to write some client validation in a class library. I added a reference to System.Web.Mvc on my local machine here C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies\System.Web.Mvc.dll
but I am getting the error
The type or namespace ModelClientValidationRule could not be found (are you missing a using directive or an assembly reference?)
I am targeting .Net Framework 4 and this MSDN link indicates that should be correct, so I am little stumped as the why the error is occurring.
I am using VS2013 and have .Net 4.5 on my local machine, and have written client validation in other projects. I expect that I could resolve this issue by adding the MVC NuGet package, but I would like to explore the alternatives.
While ModelClientValidationRule is in the namespace System.Web.Mvc, it is in the assembly System.Web.WebPages, so you need to reference that assembly too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With