Entity Framework Core Installation & Setup

Entity Framework Core Installation & Setup:  Here we see how to install and set up Entity Framework Core in the Asp.net Core application. Am assuming you have Visual Studio 2019 or above installed on your machine. Because in this whole EF Core tutorial series we are working in VS 2019 IDE.

If you haven't installed visual studio 2019, then you can install the community version (which is free) from the Microsoft official website, also you can follow this step-by-step guide to install VS 2019 on windows.

Two ways to install Entity Framework Core [Visual Studio 2019]

  1. Install EF Core using Nuget Package Manager UI.
  2. Install EF Core using Package Manager Console.

# Install EF Core using Nuget Package Manager UI.

Create New Project using Visual Studio 2019 and select Asp.net Core Web Application from the template as shown below image.

Next, we select Asp.net Core Version 5,  as we are working with the latest version (to date), optionally you can select version Asp.net core 3.1 or Asp.net Core 2.1

Now we give some valid project name to the newly created Asp.net Core project: Here we name it as LearnEntityFrameworkcore

Next, we need to install the Entity Framework Core package from Nuget Manager UI

For that from VS 2019 we go to Tools => Nuget Package Manager => Manage Nuget Packages for Solution this will open a new window screen.

As we are working with the MS SQL Server database, we installed MS SQL Server DataProvider. By typing Microsoft.EntityFrameworkCore.SqlServer, then select from the list and click the install button.

It will alert a msg, click on agree, and install it

Now from the Project Solution Explorer, we can verify whether EF Core is installed or not.

Check under Dependencies => Packages and you see in the below image the packages of entity framework core get downloaded.

Here we were successfully able to add EF Core to an existing project using Nuget Package Manager UI in Visual Studio 2019.

# Install EF Core using Package Manager Console.

To install Entity Framework Core using the package manager console we go to Tools => Nuget Package Manager => Package Manager Console.  

This will open a small screen at the bottom of visual studio 2019. Next, in this screen we type the below-given command :

PM> Install-Package Microsoft.EntityFrameworkCore.SqlServer

After executing the above command, the EF Core SQL Server provider package gets installed successfully. 

Other Reference:

PS: If you found this content valuable and want to thank me? 👳 Buy Me a Coffee