I’m trying to move my models to a separate project in my ASP.NET MVC 3 application. Everything work fine with the exception of one file where I get the error –
The type or namespace name ‘Compare’ could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name ‘CompareAttribute’ could not be found (are you missing a using directive or an assembly reference?)
The references in the new project are exactly the same as the references in the original MVC project but when this one file is moved to the new project it gives the errors above.
Any ideas what I am missing?
The
CompareAttributeClass is part of theSystem.Web.Mvcnamespace. Make sure you have that assembly as a reference in your project (in Solution Explorer -> References), and also make sure you have:At the top of your source file.
MSDN Reference on the
CompareAttributeClass:Namespace: System.Web.Mvc
Assembly: System.Web.Mvc (in System.Web.Mvc.dll)