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

Simplify tool installation instructions #2765

Merged
merged 1 commit into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
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
50 changes: 14 additions & 36 deletions entity-framework/core/miscellaneous/cli/dotnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: EF Core tools reference (.NET CLI) - EF Core
description: Reference guide for the Entity Framework Core .NET Core CLI tools
author: bricelam
ms.date: 09/17/2020
ms.date: 10/13/2020
uid: core/miscellaneous/cli/dotnet
---

Expand All @@ -18,53 +18,31 @@ When using Visual Studio, consider using the [Package Manager Console tools](xre

## Installing the tools

The installation procedure depends on project type and version:
`dotnet ef` can be installed as either a global or local tool. Most developers prefer installing `dotnet ef` as a global tool using the following command:

* EF Core 3.x and 5.x
* ASP.NET Core version 2.1 and later
* EF Core 2.x

### EF Core 3.x and 5.x

* `dotnet ef` must be installed as a global or local tool. Most developers prefer installing `dotnet ef` as a global tool using the following command:

```dotnetcli
dotnet tool install --global dotnet-ef
```

`dotnet ef` can also be used as a local tool. To use it as a local tool, restore the dependencies of a project that declares it as a tooling dependency using a [tool manifest file](/dotnet/core/tools/global-tools#install-a-local-tool).

* Install the [.NET Core SDK](https://www.microsoft.com/net/download/core).
* Install the latest `Microsoft.EntityFrameworkCore.Design` package.

```dotnetcli
dotnet add package Microsoft.EntityFrameworkCore.Design
```

### ASP.NET Core 2.1+

* Install the current [.NET Core SDK](https://www.microsoft.com/net/download/core). The SDK has to be installed even if you have the latest version of Visual Studio.

This is all that is needed for ASP.NET Core 2.1+ because the `Microsoft.EntityFrameworkCore.Design` package is included in the [Microsoft.AspNetCore.App metapackage](/aspnet/core/fundamentals/metapackage-app).
```dotnetcli
dotnet tool install --global dotnet-ef
```

### EF Core 2.x (not ASP.NET Core)
To use it as a local tool, restore the dependencies of a project that declares it as a tooling dependency using a [tool manifest file](/dotnet/core/tools/global-tools#install-a-local-tool).

The `dotnet ef` commands are included in the .NET Core SDK, but to enable the commands you have to install the `Microsoft.EntityFrameworkCore.Design` package.
Update the tool tool using the following command:

* Install the current [.NET Core SDK](https://www.microsoft.com/net/download/core). The SDK has to be installed even if you have the latest version of Visual Studio.
```dotnetcli
dotnet tool update --global dotnet-ef
```

* Install the latest stable `Microsoft.EntityFrameworkCore.Design` package.
Before you can use the tools on a specific project, you'll need to add the `Microsoft.EntityFrameworkCore.Design` package to it.

```dotnetcli
dotnet add package Microsoft.EntityFrameworkCore.Design
```
```dotnetcli
dotnet add package Microsoft.EntityFrameworkCore.Design
```

### Verify installation

Run the following commands to verify that EF Core CLI tools are correctly installed:

```dotnetcli
dotnet restore
dotnet ef
```

Expand Down
37 changes: 1 addition & 36 deletions entity-framework/core/miscellaneous/cli/powershell.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: EF Core tools reference (Package Manager Console) - EF Core
description: Reference guide for the Entity Framework Core Visual Studio Package Manager Console
author: bricelam
ms.date: 09/09/2020
ms.date: 10/13/2020
uid: core/miscellaneous/cli/powershell
---
# Entity Framework Core tools reference - Package Manager Console in Visual Studio
Expand All @@ -13,41 +13,6 @@ If you aren't using Visual Studio, we recommend the [EF Core Command-line Tools]

## Installing the tools

The procedures for installing and updating the tools differ between ASP.NET Core and other project types.

### ASP.NET Core projects

The tools are automatically included in an ASP.NET Core 2.1+ project because the `Microsoft.EntityFrameworkCore.Tools` package is included in the [Microsoft.AspNetCore.App metapackage](/aspnet/core/fundamentals/metapackage-app).

Therefore, you don't have to do anything to install the tools, but you do have to:

* Restore packages before using the tools in a new project.
* Install a package to update the tools to a newer version.

To make sure that you're getting the latest version of the tools, we recommend that you also do the following step:

* Edit your *.csproj* file and add a line specifying the latest version of the [Microsoft.EntityFrameworkCore.Tools](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Tools/) package. For example, the *.csproj* file might include an `ItemGroup` that looks like this:

```xml
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.3" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.2" />
</ItemGroup>
```

Update the tools when you get a message like the following example:

> The EF Core tools version '2.1.1-rtm-30846' is older than that of the runtime '2.1.3-rtm-32065'. Update the tools for the latest features and bug fixes.

To update the tools:

* Install the latest .NET Core SDK.
* Update Visual Studio to the latest version.
* Edit the *.csproj* file so that it includes a package reference to the latest tools package, as shown earlier.

### Other project types

Install the Package Manager Console tools by running the following command in **Package Manager Console**:

```powershell
Expand Down