Install Entity Framework 6

You need to install EntityFramework.dll (EF API) in your project in Visual Studio in order to work with the Code-First approach.

Here, we will install Entity Framework 6 API using NuGet Package Manager in Visual Studio. (You can install EF via NuGet the same way in any version of Visual Studio.)

Right click on your project in the solution explorer and select Manage NuGet Packages...

code-first environment setup

This will open the Manage NuGet Packages dialogue box. Search for EntityFramework in the top left search box and press Enter. It will display all the API/plug-ins starting with EntityFramework as shown below.

Entity Framework install

Select EntityFramework (make sure that the author is Microsoft and the version is 6.x) and click on Install. This will open the preview box as shown below. Review the changes and click OK.

Entity Framework install

Again, click on the I Accept button in the License Acceptance dialogue box to start the installation.

Entity Framework install

This will install Entity Framework API in the project.

Entity Framework install

After installation, make sure that the appropriate version of EntityFramework.dll is included in the project.

Entity Framework install

Now, we are ready to use Entity Framework in our project. Let's create our first simple code-first example in the next chapter.