efcore: `dotnet ef` does not work after running `dotnet tool install -g dotnet-ef`
Filing on behalf of @DamianEdwards
Describe what is not working as expected.
Error message: The application to execute does not exist
Steps to reproduce
With a .NET Core 3.0 SDK, run dotnet tool install -g dotnet-ef
and run dotnet ef
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 15
- Comments: 26 (4 by maintainers)
The workaround for .NET Core 3.0 SDK users is to run
I had the same issue with .NET Core 2.2 after i have installed .NET Core 3.0 Preview
when i try to execute
i get
then i did run the command
then i tried with
again then i got this error
and when i have checked this path i found that it installs it as
so i had to rename the folders manually to match and it worked fine
I was working on an older app .net core 2.0 and for me the solution was
dotnet tool uninstall --global dotnet-ef
followed by
dotnet tool install --global dotnet-ef --version 2.1.0
Then I could run
dotnet ef database update --context ApplicationDbContext
@mzrks Use
--version 3.0.0-*
to get the latest.FInally, the fix worked for me was renaming the folder names that dotnet ef was creating. The folder that dotnet ef has created: C:\Users\pratripathi.dotnet\tools.store\dotnet-ef\2.2.6\dotnet-ef\2.2.6\tools\netcoreapp2.2\any The folder that dotnet ef was trying to access: C:\Users<User>.dotnet\tools.store\dotnet-ef\2.2.6-servicing-10079\dotnet-ef\2.2.6-servicing-10079\tools\netcoreapp2.2\any Hope above fix helps to the folks who don’t want to use preview releases
I’m sure anyone reading through all this would understand this but what you really should do is head to Nuget and use the latest version (assuming you’ve just installed the latest 3.0 preview SDK), which for me, getting here after installing preview5 was not what is referenced, of course. I went here and checked:
https://www.nuget.org/packages/Microsoft.EntityFrameworkCore/3.0.0-preview5.19227.1
and used preview5 instead.
Just worth being explicit just in case 😉
@EmKayUltra I’m not in any way speaking on behalf of Microsoft or the Entity framework team here, but this is NO LONGER an issue.
Let me explain.
When I first opened this issue, I was unaware of how the versioning for the preview versions of dotnet core worked with regards to loadable tools.
Since then, I’ve done my research and spoken to many members of various MS development teams who have confirmed that tool versions are always set to match dotnet core versions.
This has nothing to do with MS separating out the tools, but it has everything to do with them enforcing matching versions so that you get the correct tool for the version of dotnet you are using.
If for example, you install a supported version of dotnet core 2.2, then simply do
"dotnet tool install --global dotnet-ef"
, the version of dotnet-ef that will be installed on your machine will be version 2.2If you then install dotnet core 3.0 without uninstalling anything else, your default working version of dotnet core will be set to version 3.0
At this point, dotnet-ef will cease to work, and the reason for this is because you at that point will not have a v3.0 compatible version of the tool installed.
If however you then once again do
"dotnet tool install --global dotnet-ef"
you’ll find that you will regain use of the ef tool, only this time it will be version 3.0 and not the 2.2 version you have been using.The same is also true for any templates you have installed. I’ve actually created a small batch file with all my
"dotnet tool install ..."
and"dotnet new install ..."
statements in, and I run it every time I update my dotnet core SDK version, thus ensuring that I have the latest versions of anything I have added to the install.
You will ONLY get problems installing these tools, in 2 specific scenarios:
In the case of (1) above, if you do a plain old “dotnet tool install --global dotnet-ef”, and your on an sdk preview and/or unsupported build, you will also see problems relating to not finding the tool.
The MS team (If you read above) have closed this issue way back in October, as there’s nothing to answer here, there is no issue, no fault, no bug or anything.
The only reason I know this keeps getting hits is because as the original author GitHub notifies me every time there is a change on it.
So finally I ask only this: Those folks who end up here because they are having trouble making the ef tool work, please read the whole thread before you post anything to it.
If after reading it all, you still believe that you’ve encountered a bug, then open a new issue in the issue tracker, and reference this thread.
Adding your “i have a bug” post to this thread is NOT going to get you the answer or the assistance you seek, because it’s now a closed issue.
Where I can find a list with all versions of dotnet tools?