Reputation: 7464
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.
Upvotes: 4
Views: 7478
Reputation: 2098
In addition to Nils answer, you may need to add Microsoft.ASP.NET.MVC package from NuGet.
Upvotes: 0
Reputation: 1321
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.
Upvotes: 9