Build errors after changing an MVC internet project from net40 to net45 RRS feed

  • Question

  • I changed my projects target framework from net 40 to net 45, and now I am getting error messages about around the account login code that was generated by Visual studio.

    The type 'System.ComponentModel.DataAnnotations.Schema.TableAttribute' exists in both 'c:\Users\Nathan\Documents\Visual Studio 2010\Projects\AorticSolutions\packages\EntityFramework.5.0.0\lib\net40\EntityFramework.dll' and 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.ComponentModel.DataAnnotations.dll' C:\Users\Nathan\Documents\Visual Studio 2010\Projects\AorticSolutions\AorticSolutions\Models\AccountModels.cs

    for one and other errors that stem from these.

    What can I do to fix my project?

    W. Nathan Manning Space City, USA (Huntsville, AL)

    Wednesday, October 31, 2012 5:26 PM


  • Hi,

    4.5 already contains the System.ComponentModel.DataAnnotations namespace. Delete the reference to System.ComponentModel.DataAnnotations and use the Entity Framework one. Also, clean the project and rebuild it.

    Hope it helps!

    Ovais Mehboob

    Thursday, November 1, 2012 5:45 PM