Compilation Error- MaxLength attribute defined in both EntityFramework and System.Data.Entity RRS feed

  • Question

  • I was trying to use the "Microsoft Entity Framework June 2011 CTP" with Code First annotations. When I modified my project to reference the June 2011 CTP assemblies, I found that the some of the annotation attributes such as "System.ComponentModel.DataAnnotations.MaxLength" is defined in two assemblies namely "EntityFramework" and "System.Data.Entity". So there is a conflict that prevents the project build.

    I then have two questions. Firstly, which assembly should I use for annotation attributes. Second, how to resolve the ambiguity  if I need to use both the assemblies.



    Sunday, July 24, 2011 2:39 PM


  • Hi,

    You can safley remove the EntityFramework reference in your project since the CTP 2011 assemblies contains DbContext/DbSet functionality.

    Also, there is a seperate forum for this CTP, http://social.msdn.microsoft.com/Forums/en/adonetefx/ which you probably get more response on the Jun2011 CTP.

    Hope this helps!


    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    • Marked as answer by Alan_chen Tuesday, August 9, 2011 9:29 AM
    Sunday, July 24, 2011 6:18 PM