Msgstr "Error executing dotnet-ef command".

As you know, the newest version of Visual Studio 2017 leaves the project "project.json" and uses it instead .csproj.

I am using the RTM version and want to generate a model from an existing database, following this guide . In the last step, I got an error:

Basic Entity Framework commands for the package manager console do not yet support csproj-based .NET Core projects. Instead, use the .NET Command Line Tools (e.g. dotnet ef). For more information, see https://go.microsoft.com/fwlink/?linkid=834381 .

After the error, I used the link mentioned to switch to dotnet ef. Here is my package manager team:

PM> dotnet ef dbcontext scaffold "Server =; Database = Jumpstart; Trusted_Connection = True;" Microsoft.EntityFrameworkCore.SqlServer

Then the error appears again:

dotnet: no executable found the corresponding dotnet-ef command

I used the help command, I found that dotnet does not have a command called ef.

I just want to create a model from an existing database.

+6
source share
5 answers

Follow this guide

https://docs.microsoft.com/en-us/aspnet/core/data/ef-mvc/migrations

I had the same problem. Just edited the ItemGroup section in .csproj , like this

<ItemGroup>
   <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
</ItemGroup>
+7
source

tools :

"tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final",
    "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4-final"
  },

:

  • dotnet restore -
  • dotnet ef migrations
+2

NetCore 2.0 Add-Migrations.

. , appsettings.json

0

DotNet, , ,

EF Core.NET *.csproj.

Microsoft.EntityFrameworkCore.Tools.DotNet DotNetCliToolReference. . .

<ItemGroup>
   <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
</ItemGroup>

2 2

importatn ( visuall 2017)

1 - dotnet add package Microsoft.EntityFrameworkCore.Design

2 - dotnet restore. , .

https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/dotnet

0
source

The accepted answer is the most likely cause of the error message. However, in addition to adding the correct link in the file, .csprojalso make sure that the current directory from Package Manager Consolepoints to the ASP.NET Core project , otherwise any command dotnet efwill fail with an OP header error.

0
source

Source: https://habr.com/ru/post/1015886/


All Articles