I have a working website targeting .Net 4.0 and entity framework 4.3.1.
After installing .Net 4.5 ( with Visual Studio Express 2012 ) I can compile the website on Visual Web Developer Express 2010 but when i try to navigate to
http://localhost/
I get this error:
CS0246 “The type or namespace name ‘MaxLength’ could not be found” on
[Column("titulo"), Required(), MaxLength(150)]
Línea 13: public string Titulo { get; set; }
I have this using statement:
using System.ComponentModel.DataAnnotations;
The application pool on IIS is configured for .Net 4.0.
I tried updating Entity framework to 4.4 ( from Nuget ) and added this using statement:
using System.ComponentModel.DataAnnotations.Schema;
But then the error is:
CS0246 “The type or namespace name ‘Column’ could not be found”
Any suggestion to solve the problem?
Thx.
To make this work you have to do the following:
Open NuGet package manager and find in the
Installed packagestabthe Entity Framework package. Uninstall it.
Now Go to the
Onlinetab and search for Entity Framework. Hitinstall. Now your project should reference the correct version of EF
that is
5.0instead of4.4.0(the version I had before intallingthis new version).
Hope it helps.
For more info, take a look here: http://forums.asp.net/t/1779042.aspx/1