1

I have two projects in the same solution. One is an ASP.NET MVC 2 Empty Web Application, the other is a Console Application.

In the first project i create a database with EF and a class to access the database. What I want to do is add the first project as a reference to the console app project so i can use this class

I included it as a reference already it appears at the References, and after is include a using directive at the top of my console app i can even use code assistance. But when i compile i always get the error:

The type or namespace name 'DBModel' could not be found (are you missing a using directive or an assembly reference?)

How can i compile my projects?

Sincerely,

Zoli

DinoMyte
  • 8,737
  • 1
  • 19
  • 26
Zoltan Varadi
  • 2,468
  • 2
  • 34
  • 51

2 Answers2

3

From your description, if I'm getting it right,

That's often the case when you have different target .NET framework (Project properties, Application, Target Framework) - i.e. one is e.g. .NET 4.0 Client Profile - and the lib you're referencing is just .NET 4.0.

NSGaga-mostly-inactive
  • 14,052
  • 3
  • 41
  • 51
  • This was my problem too: thanks! But... what's the difference between vanilla .NET 4.0 and the Client Profile version? – Eric Nelson Mar 07 '13 at 06:19
  • 1
    my pleasure ;) - Here is a good link http://stackoverflow.com/questions/2759228/difference-between-net-4-client-profile-and-full-framework-download – NSGaga-mostly-inactive Mar 07 '13 at 11:27
0

It's also possible that you're missing a reference to the Entity Framework in your Console application.

See this post for more info: http://www.dotnetcurry.com/ShowArticle.aspx?ID=617 (just below the middle, step 3).

Erwin B.
  • 196
  • 4