Installation And Un-Installation Of Entity Framework Core In ASP.NET MVC Core

Introduction

This article explains how to install and uninstall Entity Framework in ASP.NET MVC Core. We can install and uninstall EF in two different ways, as explained below.

Installation

Step 1

Open Visual Studio 2017. Go to File >> New >> Project. Now, select “ASP.NET Core Web Application (.NET Core)” under the web in Visual C#. Selection looks like the below screenshot. Click OK.

Entity Framework

Step 2

Now, the “New ASP.NET Core Web Application (.Net Core)” window will open. In this window, select ASP.NET Core version, select “Web Application”, and click OK.

Entity Framework

Step 3

Our new project has opened. Go to Tools >> NuGet Package Manager, and click “Manage NuGet Packages for Solution”.

Entity Framework

Now, the NuGet – Solution window will open. Select "Browse" in NuGet Solution and enter “entity framework core” in the search box. We get many lists after entering the keyword in the search box, the list looks like below screenshot. Locate “Microsoft.EntityFrameworkCore”.

Entity Framework

If we are using SQL Server as a database, we can only install “Microsoft.EntityFrameworkCore.SqlServer”.

Entity Framework

Step 4

Here, we are going to installing ”Microsoft.EntityFrameworkCore”. It is used to access the data for all different types of back-ends. Now, select “Microsoft.EntityFrameworkCore” and select cthe project check box that we are going to install. Then, click the Install button.

Entity Framework

A preview window will open. Now, click OK button in the preview window.

Entity Framework

Next, the License Acceptance window will open. For Entity Framework Core, we need to accept license terms so need to click “I Accept”.

Entity Framework

Step 5

It will take few minutes to install EF core. We will be getting a success message after installation of EF Core, which looks like the below screenshot.

Entity Framework

Step 6

Go to Solution Explorer >> Dependencies >> NuGet to locate the “Microsoft.EntityFrameworkCore” option.

Entity Framework

Entity Framework Uninstall

We can uninstall Entity Framework from our project or our solution very easily. Go to Tools >>  “NuGet Package Manager” >> “Manage NuGet Packages for Solution”.

Entity Framework

Type “Microsoft.EntityFrameworkCore” in the search box and get lists. We see a green tick mark on items that are already installed in our solutions.

Entity Framework

Now, select “Microsoft.EntityFrameworkCore” and the project checkbox will appear. We need to click on Uninstall button.

Entity Framework

Again, a preview window will be opened. Now, click OK button from preview window which will uninstall the Entity Framework.

Entity Framework

After uninstall, the “Microsoft.EntityFrameworkCore” file is removed from our project.

Entity Framework

Conclusion

This article explained how to install and uninstall Entity Framework Core in ASP.NET MVC Core. I hope this is helpful to new learners.

Up Next
    Ebook Download
    View all
    Learn
    View all