If you are using the .Net Entity Framework and you are passing those Entity Framework objects through controls in your UI (.aspx, .ascx) pages such as a Repeater control (using the ) you will most likely see the following error message:
CS0012: The type ‘System.Data.Objects.DataClasses.EntityObject’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’.
You may have added the assembly to your web application’s References but I guess this is not enough. You must also add the reference to your web.config file. You can do this by adding the following line to your ‘compilation/assemblies’ section so it looks like the following:
Thanks, you've saved me a lot of time!
LikeLike
schleichermann,
How can I resolve this same problem in asp.net 4.0?
Appreciate your help!
LikeLike
Great, just what i was looking for.
LikeLike
Thanks, this was a great and easy find.
NateDog, for .Net 4.0 the just switch the version to 4.0.0.0 such as:
LikeLike
Thanks schleichermann. I first thought that I only had to add the reference on the Reference folder, but I guess that it has to be done on the web.config file too. Thanks a lot.!
LikeLike
Thanks schleichermann! I was beating my head against the wall
LikeLike
thanks!! thanks!! and thanks!!
LikeLike
This Post has helped me !
I have been trying to use CAST to my Object “Product” and I have did reference in the “Add reference” but is not enough, like you said.
I have added the reference in web.config and it works!
Thanks so much!
😉
LikeLike
This worked perfect, thanks!
LikeLike
[…] But still the issue was presented. I finally figured out the clue from another word press blog. I had to add the assembly entry in the Web.config to resolve the issue. […]
LikeLike
Thanks for this mate, it saved me a lot of time 🙂
LikeLike