Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Installing EF Core #4295

Merged
merged 3 commits into from
Mar 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 10 additions & 27 deletions entity-framework/core/get-started/overview/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,21 @@
title: Installing Entity Framework Core - EF Core
description: Installation instructions for Entity Framework Core
author: bricelam
ms.date: 08/06/2017
ms.date: 03/23/2023
uid: core/get-started/overview/install
---
# Installing Entity Framework Core

## Prerequisites

* EF Core is a [.NET Standard 2.0](/dotnet/standard/net-standard) library. So EF Core requires a .NET implementation that supports .NET Standard 2.0 to run. EF Core can also be referenced by other .NET Standard 2.0 libraries.

* For example, you can use EF Core to develop apps that target .NET Core. Building .NET Core apps requires the [.NET Core SDK](https://dotnet.microsoft.com/download). Optionally, you can also use a development environment like [Visual Studio](https://visualstudio.microsoft.com/vs), [Visual Studio for Mac](https://visualstudio.microsoft.com/vs/mac), or [Visual Studio Code](https://code.visualstudio.com). For more information, check [Getting Started with .NET Core](/dotnet/core/get-started).
* EF requires the most recent [.NET SDK](https://dotnet.microsoft.com/en-us/download).
* At runtime, EF Core requires a recent version of .NET. See [_EF Core releases_)](xref:core/what-is-new/index) to find the minimal .NET version needed for the version of EF Core that you want to use.

* You can use EF Core to develop applications on Windows using Visual Studio. The latest version of [Visual Studio](https://visualstudio.microsoft.com/vs) is recommended.

* EF Core can run on other .NET implementations like [Xamarin](https://dotnet.microsoft.com/apps/xamarin) and .NET Native. But in practice those implementations have runtime limitations that may affect how well EF Core works on your app. For more information, see [.NET implementations supported by EF Core](xref:core/miscellaneous/platforms).

* Finally, different database providers may require specific database engine versions, .NET implementations, or operating systems. Make sure an [EF Core database provider](xref:core/providers/index) is available that supports the right environment for your application.

## Get the Entity Framework Core runtime
## Get Entity Framework Core

To add EF Core to an application, install the NuGet package for the database provider you want to use.

If you're building an ASP.NET Core application, you don't need to install the in-memory and SQL Server providers. Those providers are included in current versions of ASP.NET Core, alongside the EF Core runtime.
EF Core is shipped as [NuGet packages](https://www.nuget.org/). To add EF Core to an application, install the NuGet package for the database provider you want to use. See [_Providers_](xref:core/providers/index) for a list of the database providers available.

To install or update NuGet packages, you can use the .NET Core command-line interface (CLI), the Visual Studio Package Manager Dialog, or the Visual Studio Package Manager Console.

Expand All @@ -35,7 +28,7 @@ To install or update NuGet packages, you can use the .NET Core command-line inte
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
```

* You can indicate a specific version in the `dotnet add package` command, using the `-v` modifier. For example, to install EF Core 2.2.0 packages, append `-v 2.2.0` to the command.
* You can indicate a specific version in the `dotnet add package` command, using the `-v` modifier. For example, to install EF Core 6.0.14 packages, append `-v 6.0.14` to the command.

For more information, see [.NET command-line interface (CLI) tools](/dotnet/core/tools/).

Expand All @@ -61,7 +54,7 @@ For more information, see [NuGet Package Manager Dialog](/nuget/tools/package-ma

* To update the provider, use the `Update-Package` command.

* To specify a specific version, use the `-Version` modifier. For example, to install EF Core 2.2.0 packages, append `-Version 2.2.0` to the commands
* To specify a specific version, use the `-Version` modifier. For example, to install EF Core 6.0.14 packages, append `-Version 6.0.14` to the commands

For more information, see [Package Manager Console](/nuget/tools/package-manager-console).

Expand All @@ -75,12 +68,6 @@ Two sets of tools are available:

* The [Package Manager Console (PMC) tools](xref:core/cli/powershell) run in Visual Studio on Windows. These commands start with a verb, for example `Add-Migration`, `Update-Database`.

Although you can also use the `dotnet ef` commands from the Package Manager Console, it's recommended to use the Package Manager Console tools when you're using Visual Studio:

* They automatically work with the current project selected in the PMC in Visual Studio, without requiring manually switching directories.

* They automatically open files generated by the commands in Visual Studio after the command is completed.

<a name="cli"></a>

### Get the .NET Core CLI tools
Expand Down Expand Up @@ -114,14 +101,10 @@ To get the Package Manager Console tools for EF Core, install the `Microsoft.Ent
Install-Package Microsoft.EntityFrameworkCore.Tools
```

For ASP.NET Core apps, this package is included automatically.

## Upgrading to the latest EF Core

* Any time we release a new version of EF Core, we also release a new version of the providers that are part of the EF Core project, like Microsoft.EntityFrameworkCore.SqlServer, Microsoft.EntityFrameworkCore.Sqlite, and Microsoft.EntityFrameworkCore.InMemory. You can just upgrade to the new version of the provider to get all the improvements.

* EF Core, together with the SQL Server and the in-memory providers are included in current versions of ASP.NET Core. To upgrade an existing ASP.NET Core application to a newer version of EF Core, always upgrade the version of ASP.NET Core.
* Any time we release a new version of EF Core, we also release a new version of the providers that are part of the EF Core project, like [Microsoft.EntityFrameworkCore.SqlServer](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.SqlServer), [Microsoft.EntityFrameworkCore.Sqlite](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Sqlite), [Microsoft.EntityFrameworkCore.Cosmos](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Cosmos), and [Microsoft.EntityFrameworkCore.InMemory](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.InMemory). You can just upgrade to the new version of the provider to get all the improvements.

* If you need to update an application that is using a third-party database provider, always check for an update of the provider that is compatible with the version of EF Core you want to use. For example, database providers for version 1.0 are not compatible with version 2.0 of the EF Core runtime.
* If you need to update an application that is using a third-party database provider, always check for an update of the provider that is compatible with the version of EF Core you want to use. For example, database providers for version 1.0 are not compatible with version 2.0 of the EF Core runtime, and so on.

* Third-party providers for EF Core usually don't release patch versions alongside the EF Core runtime. To upgrade an application that uses a third-party provider to a patch version of EF Core, you may need to add a direct reference to individual EF Core runtime components, such as Microsoft.EntityFrameworkCore, and Microsoft.EntityFrameworkCore.Relational.
* Third-party providers for EF Core usually don't release patch versions alongside the EF Core runtime. To upgrade an application that uses a third-party provider to a patch version of EF Core, you may need to add a direct reference to individual EF Core runtime components, most notably [Microsoft.EntityFrameworkCore](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore/), and [Microsoft.EntityFrameworkCore.Relational](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Relational/).