efcore icon indicating copy to clipboard operation
efcore copied to clipboard

No executable found matching command "dotnet-ef"

Open xatabhk opened this issue 10 years ago • 18 comments

"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"

xatabhk avatar Mar 15 '16 02:03 xatabhk

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

bricelam avatar Mar 15 '16 04:03 bricelam

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

haroldma-zz avatar Mar 17 '16 23:03 haroldma-zz

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

mikes-gh avatar Mar 18 '16 10:03 mikes-gh

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?

rob-stockfleth avatar Mar 18 '16 21:03 rob-stockfleth

Also tracked by parent item #3925

bricelam avatar Mar 22 '16 16:03 bricelam

Closing as tracked by parent item

rowanmiller avatar Mar 22 '16 18:03 rowanmiller

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 avatar May 17 '16 17:05 christianrondeau

@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.

rowanmiller avatar May 17 '16 17:05 rowanmiller

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.

tedd avatar Jun 20 '16 09:06 tedd

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

Korigoth avatar Jul 20 '16 04:07 Korigoth

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\Java\javapath;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 Files\dotnet\bin;C:\Program Files\Git\cmd;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\dotnet;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.

tedd avatar Jul 27 '16 11:07 tedd

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 avatar Sep 02 '16 21:09 CornFlakers

@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/.

divega avatar Sep 02 '16 21:09 divega

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 avatar Dec 11 '16 05:12 benjamincburns

@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)

t0xicDen avatar Dec 11 '16 18:12 t0xicDen

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?

jholovacs avatar Jan 04 '17 00:01 jholovacs

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>

johnnyreilly avatar Apr 14 '17 06:04 johnnyreilly

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

kunjan-ss avatar Jun 05 '17 20:06 kunjan-ss