DataAnnotations with Database First RRS feed

  • Question

  • I have downloaded two dlls from the following source I have also used the MVC3 futures as well from another source.

    I am using ASP.Net/MVC 3, EF 4.1 & .Net 4.0 Framework. The only reason I installed the below was from posts I had read.

    I have Silverlight4 on my machine and the .Net RIA Services SP1 installed as well. I needed these installed from what I read on the web for the DataAnnotations to work.

    In my global.asax file, I have the following code and a design time compile error saying that "The type or namespace 'DataAnnotations' does not exist in the namespace 'Microsoft.Web.Mvc'".


    public void RegisterModelBinders(ModelBinderDictionary binders)


    binders.DefaultBinder = new Microsoft.Web.Mvc.DataAnnotations.DataAnnotationsModelBinder();

    } </code>

    When I install the two dlls from the downloaded project, the design time compile error goes away. However, everytime when I try to build the project, I get the above compile error! I'm stuck and can't move forward!

    would you happen to have a resolution on which dlls to use with this type of project? No matter what I try, I can't get the project to compile.

    I have the following pertinent dlls installed for this project:

    •Microsoft.Web.Mvc -v4.0.30319

    •Microsoft.Web.Mvc.DataAnnotations - v2.0.50727

    •System.Web.Mvc - v4.0.30319

    I have also used the version of the Microsoft.Web.Mvc dll.


    Bill Yeager


    Can someone please inform me exactly what I need to install for DataAnnotations using the Database First approach? Obviously, what I outlined above is not working and from the looks of it, don't know if anybody is using it from the lack of responses. I can't even get the project to compile based on the way it's presently set up (see above). 

    For more info, I am getting the following errors when I try to compile my project:

    Error 6 The type or namespace name 'DataAnnotations' does not exist in the namespace 'Microsoft.Web.Mvc' (are you missing an assembly reference?) C:\Users\byeager\My Documents\Visual Studio 2010\Projects\YeagerTech\YeagerTech\YeagerTech\Global.asax.cs 47 59 YeagerTech

    Warning 5 The primary reference "Microsoft.Web.Mvc.DataAnnotations" could not be resolved because it has an indirect dependency on the .NET Framework assembly "System.ComponentModel.DataAnnotations, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which has a higher version "" than the version "" in the current target framework. C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets 1360 9 YeagerTech

    I have the following pertinent DLLs in my project:



    • From the C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.ComponentModel.DataAnnotations.dll - v
    • From a download into: C:\Users\byeager\My Documents\Visual Studio 2010\Projects\DataAnnotations\src\bin\Debug\Microsoft.Web.Mvc.DataAnnotations.dll - v1.0.0.0

    All I'm asking is what dlls and what versions should I have in my project for reference in order to compile?


    Saturday, July 23, 2011 12:50 AM

All replies