Efcore: No executable found matching command "dotnet-ef"

Created on 15 Mar 2016  路  18Comments  路  Source: dotnet/efcore

"tools": {
    "dotnet-publish-iis": "1.0.0-*",
    "dotnet-razor-tooling": "1.0.0-*",
    "dotnet-ef": "1.0.0-*"
},

dotnet restore
dotnet ef
No executable found matching command "dotnet-ef"

Most helpful comment

You might want to try filing on the dotnet/cli repo. Everything there looks correct.

Also, ensure you're running dotnet ef from the directory containing the project.json

All 18 comments

You might want to try filing on the dotnet/cli repo. Everything there looks correct.

Also, ensure you're running dotnet ef from the directory containing the project.json

Reporting in with the same issue. May it have to do with targeting both dnx451 and dnxcore50?

Same error here
If I am only targeting net451 will that be an issue?

Same problem.. targeting only net451 and trying to dotnet ef dbcontext scaffold... from the same directory as my project.json
No executable found matching command "dotnet-ef"

I have the latest dotnet exe, but is there a separate install to put the EF tools on a system?

Also tracked by parent item #3925

Closing as tracked by parent item

I could not find any solution or reference to a solution in #3925 - I am using

When I run (in the Package Manager Console)

> dotnet ef
No executable found matching command "dotnet-ef"

Here's the dotnet version:

> dotnet --version
1.0.0-preview1-002702

Here's the project.json pieces that relate to EF:

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0-rc2-3002702",
      "type": "platform"
    },
    "Microsoft.EntityFrameworkCore": "1.0.0-rc2-final",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview1-final"
  },

  "tools": {
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-*",
      "imports": "portable-net452+win81"
    },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "dnxcore50",
        "portable-net452+win81"
      ]
    }
  },

I have installed Microsoft .NET Core 1.0.0 RC2 - VS 2015 Tooling Preview 1 and Microsoft .NET Core 1.0.0 RC2 - SDK Preview 1 (x64), I have fully uninstalled RC1 before and dotnet restore works... I'm out of ideas.

@christianrondeau opened https://github.com/aspnet/EntityFramework/issues/5392 to help you with this one as all the known issues from this thread and #3925 are fixed.

Observation: Uninstalling Core RC2 and reinstalling (including the VC++ reinstall workaround) seems to have cleared system PATH environment variable and added only its own paths. This made the dotnet ef command fail as described above. Copied system PATH variables from another computer, restarted CMD window and it worked fine again.

can you share the path plz?
saying you copied from another PC doesn't tell us what it is missing from our own PATH variable.

Because i still get the error and there were nothing in my path variable

It completely cleared the PATH variable, as in: The PATH variable contained no data at all. It is supposed to contain a lot of stuff. What it contains varies from computer to computer.

Here is from one of my computers:
C:>echo %path%
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\libnvvp;;E:\Python\Python35-32\Scripts\;E:\Python\Python35-32\;C:\ProgramData\Oracle\Javajavapath;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\System32\Wbem;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Filesdotnet\bin;C:\Program Files\Git\cmd;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Filesdotnet\;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files\nodejs;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\TortoiseGit\bin;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:Users\myuser.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin;C:Users\myuser.dnx\bin;C:Users\myuser\AppData\Roaming\npm;C:\Program Files\Docker Toolbox

So the lack of both Windows, System32 and DNX (and possibly more) in path made it fail.

the tutorial https://docs.asp.net/en/latest/tutorials/first-mvc-app/adding-model.html
is incorrect, you have to be in the path where project.json is which is where all the other files are > mvc movie

@CornFlakers can you clarify what part you think is wrong about the tutorial? I see it recommends opening a command line window on the controllers folder and then typing cd .. to go to the project folder where the project.json file is. Anyway, if you find any bugs in that tutorial please create issues in https://github.com/aspnet/docs/.

To anyone finding this after targeting EF Core 1.1, per the release announcement blog post, make sure you've updated your tooling dependency from Microsoft.EntityFrameworkCore.Tools to Microsoft.EntityFrameworkCore.Tools.DotNet version 1.1.0-preview4.

@benjamincburns
Thanks! It helps.

One note more: if you get such error message when create new migration

Unrecognized option '--config'

To fix it I updated version to 1.2.0-preview4-22886 (issues/7076)

I'm getting a message like below when trying to add a migration after changing Microsoft.EntityFrameworkCore.Tools to Microsoft.EntityFrameworkCore.Tools.DotNet:
Cannot execute this command because 'Microsoft.EntityFrameworkCore.Tools' is not installed in project 'MySolution.MyEfProject'. Add 'Microsoft.EntityFrameworkCore.Tools' to the 'tools' section in project.json.

Is there a dependency mismatch somewhere?

If you're working with csproj you might find you need this:

dotnet ef dbcontext scaffold "Server=.\;Database=AdventureWorksLT2012;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer --output-dir Models

The packages you need in your csproj:

  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0" PrivateAssets="All" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.1" PrivateAssets="All" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" />
  </ItemGroup>

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

Also, don't forget to do dotnet restore after that.

Was this page helpful?
0 / 5 - 0 ratings