EntityFrameworkCore does not exist in the namespace Microsoft

asp.net-mvc c# entity-framework-core


I am trying to walk through this tutorial here.


However after successfully installing EntityFrameworkCore in the package manager console using the command:

Install-Package Microsoft.EntityFrameworkCore.SqlServer

then running a dotnet restore successfully in the cmd, the project does not register EntityFrameworkCore. In the .csproj file you can see the line

<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" />

Unfortunately whenever I add a using statement with Microsoft.EntityFrameworkCore in a file I get the error mentioned in the title. Any idea why this might be happening?

3/24/2017 9:01:11 PM

Accepted Answer

I solved this problem by:

(1) Right clicking the project in the Solution Explorer

(2) Clicking unload project

(3) Click edit the .csproj and check if there is a Package Reference to EF

(4) Right clicking the project again in the Solution Explorer

(5) Then clicked reload project

Now it recognizes EntityFrameworkCore and there are no more build errors

3/24/2017 8:58:17 PM

Popular Answer

You missed a required Nuget Package, according to microsoft, you will need to install 3 packages in total, but in my case, it is only required 2 packages as the following:

  • Microsoft.EntityFrameworkCore.SqlServer
  • Microsoft.EntityFrameworkCore.Tools

Hope this can solve your problem.

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