Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC: Multiple Projects Error

Tags:

asp.net-mvc

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!

like image 819
dcolumbus Avatar asked Nov 23 '10 20:11

dcolumbus


2 Answers

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.

like image 62
dcolumbus Avatar answered Nov 16 '22 08:11

dcolumbus


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

like image 3
Paddy Avatar answered Nov 16 '22 08:11

Paddy