dcolumbus
dcolumbus

Reputation: 9714

ASP.NET MVC: Multiple Projects Error

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!

Upvotes: 9

Views: 5905

Answers (2)

dcolumbus
dcolumbus

Reputation: 9714

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.

Upvotes: 19

Paddy
Paddy

Reputation: 33867

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

Upvotes: 3

Related Questions