162

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" />
Erik Philips
  • 53,428
  • 11
  • 128
  • 150
Beth
  • 1,655
  • 2
  • 10
  • 6

10 Answers10

189

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....                                           

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.

Sven Eberth
  • 3,057
  • 12
  • 24
  • 29
ChrisS
  • 1,919
  • 2
  • 11
  • 6
87

There are two versions: 1 and 4. EFv4 is part of .net 4.0, and EFv1 is part of .net 3.5 SP1.

Yes, the config setting above points to EFv4 / .net 4.0.

EDIT 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 runtime version v4.0.30319 with the Version property showing 4.0.0.0. The EntityFramework.dll can be viewed in this fashion also. Only the Version will be 4.1.0.0 and the Runtime version will be v4.0.30319 which specifies it is a .NET 4 component. Alternatively, you can open the file location as listed in the Path property and right-click the component in question, choose properties, then choose the details tab and view the product version.

Chris Baker
  • 49,926
  • 12
  • 96
  • 115
KristoferA
  • 12,287
  • 1
  • 40
  • 62
42

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> 
Community
  • 1
  • 1
26

if you are using EF core this command below could help

dotnet ef --version
Namig Hajiyev
  • 1,117
  • 15
  • 16
18

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

Marcel
  • 15,039
  • 20
  • 92
  • 150
11

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.

PedroC88
  • 3,708
  • 7
  • 43
  • 77
RickIsWright
  • 121
  • 1
  • 5
3

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

Demodave
  • 6,242
  • 6
  • 43
  • 58
3
   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;
    }
Simple Fellow
  • 4,315
  • 2
  • 31
  • 44
2

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

1

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