dotnet ef not found in .NET Core 3

后端 未结 8 1842
囚心锁ツ
囚心锁ツ 2020-12-02 04:35

I\'m following the docs in order to create an initial migration. When I execute dotnet, I get the help section, meaning that the PATH works properly.

Th

8条回答
  •  南笙
    南笙 (楼主)
    2020-12-02 05:02

    See the announcement for ASP.NET Core 3 Preview 4, which explains that this tool is no longer built-in and requires an explicit install:

    The dotnet ef tool is no longer part of the .NET Core SDK

    This change allows us to ship dotnet ef as a regular .NET CLI tool that can be installed as either a global or local tool. For example, to be able to manage migrations or scaffold a DbContext, install dotnet ef as a global tool typing the following command:

    dotnet tool install --global dotnet-ef
    

    To install a specific version of the tool, use the following command:

    dotnet tool install --global dotnet-ef --version 3.1.4
    

    The reason for the change is explained in the docs:

    Why

    This change allows us to distribute and update dotnet ef as a regular .NET CLI tool on NuGet, consistent with the fact that the EF Core 3.0 is also always distributed as a NuGet package.

    In addition, you might need to add the following NuGet packages to your project:

    • Microsoft.EntityFrameworkCore.SqlServer
    • Microsoft.EntityFrameworkCore.Design
    • Microsoft.EntityFrameworkCore.Tools

提交回复
热议问题