[entity-framework] Determine version of Entity Framework I am using?

I believe there are two versions 1 and 2? And version 2 is referred to as Entity Framework 4.0?

How can I tell what version is being used in an application?

This is in my web.config does this mean I am using version 2?

<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

This question is related to entity-framework

The answer is


For .NET Core, this is how I'll know the version of EntityFramework that I'm using. Let's assume that the name of my project is DemoApi, I have the following at my disposal:

  1. I'll open the DemoApi.csproj file and take a look at the package reference, and there I'll get to see the version of EntityFramework that I'm using.
  2. Open up Command Prompt, Powershell or Terminal as the case maybe, change the directory to DemoApi and then enter this command: dotnet list DemoApi.csproj package

If you open the references folder and locate system.data.entity, click the item, then check the runtime version number in the Properties explorer, you will see the sub version as well. Mine for instance shows v4.0.30319 with the Version property showing 4.0.0.0.


Another way to get the EF version you are using is to open the Package Manager Console (PMC) in Visual Studio and type Get-Package at the prompt. The first line with be for EntityFramework and list the version the project has installed.

PM> Get-Package

Id                             Version              Description/Release Notes                                                                                                                                                                                          
--                             -------              -------------------------                                                                                                                                                                                          
EntityFramework                5.0.0                Entity Framework is Microsoft's recommended data access technology for new applications.                                                                                                                           
jQuery                         1.7.1.1              jQuery is a new kind of JavaScript Library....                                           `enter code here`

It displays much more and you may have to scroll back up to find the EF line, but this is the easiest way I know of to find out.


   internal static string GetEntityFrameworkVersion()
    {
        var version = "";
        var assemblies = System.AppDomain.CurrentDomain.GetAssemblies().Select(x => x.FullName).ToList();
        foreach(var asm in assemblies)
        {
            var fragments = asm.Split(new char[] { ',', '{', '}' }, StringSplitOptions.RemoveEmptyEntries).Select(x=> x.Trim()).ToList();
            if(string.Compare(fragments[0], EntityFramework, true)==0)
            {
                var subfragments = fragments[1].Split(new char[] { '='}, StringSplitOptions.RemoveEmptyEntries);
                version =subfragments[1];
                break;
            }
        }
        return version;
    }

can check it in packages.config file.

<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.0.2" targetFramework="net40-Client" />
</packages> 

To answer the first part of your question: Microsoft published their Entity Framework version history here.


If you go to references, click on the Entity Framework, view properties It will tell you the version number.


if you are using EF core this command below could help

dotnet ef --version

In Solution Explorer Under Project Click on Dependencies->NuGet->Microsoft.NetCore.All-> Here list of all Microsoft .NetCore pakcages will appear. Search for Microsoft.EntityFrameworkCore(2.0.3) in bracket version can be seen Like this

After finding package