Resolving: Cannot find command 'dotnet ef' and then dotnet-ef.dll isn't in the right folder?

'dotnet ef' refusing to work

So in my post yesterday I noted that dotnet ef wasn't present anymore and following the instructions to install it gave me a broken installation of dotnet ef.

The hack I used of copying files around to satisfy the paths that were being winged about were because, even with the specific details of the error message a cursory search wasn't returning anything useful. It wasn't until I hit GitHub to raise an issue against the tooling that I found details that explain what's going on. The fact that dotnet ef isn't present automatically is a change as part of .NET Core 3 ( announcement, EF Core 3.0 breaking changes).

So, in order for the tool to work properly it needs to be installed requesting a version explictly (at the moment, hopefull this is a requirement that'll go away once 3.0 leaves preview) which means I need to un-pick what I've done and re-run the install. First up, deleting the 2.2.4-servicing-10062 folder I created in %userprofile%\.dotnet\tools\.store\dotnet-ef so that everything is back as it was as the tooling intended. Then I'm going to uninstall the incorrectly installed version of 2.2.4 with dotnet tool uninstall dotnet-ef --global which should give a response of:

Tool 'dotnet-ef' (version '2.2.4') was successfully uninstalled.

Finally I can install the correct version by running dotnet tool install dotnet-ef --version 3.0.0-preview4.19216.3 --global which should give the following response:

You can invoke the tool using the following command: dotnet-ef
Tool 'dotnet-ef' (version '3.0.0-preview4.19216.3') was successfully installed.

Finally, running dotnet ef doesn't moan about something missing without me having to copy files around manually:

               ---==/    \\
         ___  ___   |.    \|\
        | __|| __|  |  )   \\\
        | _| | _|   \_/ |  //|\\
        |___||_|       /   \\\/\\

Entity Framework Core .NET Command-line Tools 3.0.0-preview4.19216.3

About Rob

I've been interested in computing since the day my Dad purchased his first business PC (an Amstrad PC 1640 for anyone interested) which introduced me to MS-DOS batch programming and BASIC.

My skillset has matured somewhat since then, which you'll probably see from the posts here. You can read a bit more about me on the about page of the site, or check out some of the other posts on my areas of interest.

No Comments

Add a Comment