9

So I've create a solution with multiple projects... one is for my website, the other for my data. I've added the reference and everything seems to be working just fine. Until now...

I recently created a model.edmx for a table and a stored procedure. When I trying and create a variable of that model, I get this error:

The type 'System.Data.Objects.ObjectContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

I'm assuming this is because I'm using multiple projects, I just don't know how to fix this!

2 Answers 2

19

Ah... just like having to add the reference to the other projects within the solution, I had to add a reference to the System.Data.Entity using that same right-click "Add Reference" dialog.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks a lot, this saved me lots of time as mine wasn't giving me the above error but just "The type 'System.Data.Objects.ObjectContext' is defined in an assembly that is not referenced"
3

The project where you are trying to create a model object needs to have a reference to System.Data.Entity (as the error states).

2 Comments

Yes, and I added the same reference within my assemblies ... still doesn't work.
Are you referencing the right version though? I'm not up on EF, but I believe there are separate versions for 3.5 and 4.0, as well as a CTP floating aroudn out there. The error message states it's looking for 4.0.0.0. Check your reference to make sure its the correct version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.