DBSet class not found (Entity Framework loading wrong DLL?)

.net asp.net-mvc c# entity-framework-6 visual-studio


In my Visual Studio 2015 project I have a declaration

public DBSet<Page> Pages { get; set; }

which gives me the error

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

.. which shouldn't be happening because I have ...

using System.Data.Entity;

at the start of the file.

DBSet class was introduced in Entity Framework 5. I 'm using V 6.1.32.

I have a feeling this is related to my other problem: ModelConfiguration does not exist in the namespace 'System.Data.Entity'

It appears that in spite of having EF 6 installed somehow a DLL of EF 4 is being used. If I try to manually add a reference to system.data.entity (obviously not a good idea) is the version number that is shown.

I tried the following sequence (as was suggested in a comment in my other question)...

  1. Uninstall EF using NuGet.
  2. Delete bin folder
  3. Reinstall EF using NuGet

I even tried uninstalling and reinstalling VS 2015.

Is there another folder in my project or my computer that contains DLLs that may be used by VS?

When I installed SQL Server Management Studio 2014, VS 2010 was also automatically installed. Could this be interfering with VS 2015?

I'm getting quite desperate as this is stopping me from continuing my MVC project.

5/23/2017 12:31:11 PM

Accepted Answer

Check your casing. I believe it is: DbSet<T>. So, in this case:

public DbSet<Page> Pages { get; set; }
3/8/2016 11:38:18 PM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow