I had an issue running an EntityFramework command after updating the NuGet packages to the latest version and searching got me to multiple steps and sites to get things fixed. Grouping them here for future reference.
If it helps you as well, please let me know! Always nice to see these posts helping someone else as well.
This was the initial message that got me on this path:
The EF Core tools version '2.2.0-rtm-35687' is older than that of the runtime '3.1.8'. Update the tools for the latest features and bug fixes.
The number one skill you need as a developer / engineer / person who needs to do this, is asking for help. Learning how to use your google skills to find solution is one way to do it. Even after ~15 years of programming I do this all day long.
For this one, I had to use multiple sources to find a fix.
A .NET Core tool is a special NuGet package that contains a console application and can be installed in several ways:
Installing or updating any global .NET Core tool can be done with the same command:
> dotnet tool update --global dotnet-ef
donet tool installas well, but the update command does the same thing and will install the tool if it is not installed yet.
Unfortunately running the update resulted in the following error. Seems like we are going down the rabbit hole again…
> dotnet tool update --global dotnet-ef Tool 'dotnet-ef' has multiple versions installed and cannot be updated.
The .NET Core tools are installed in your user folder by default. There is no centralized storage of what versions are installed, the commands will be found if they can be found in this folder. So, you can look what it contains:
Each tool has its own folder and in that are folders for each version.
Since there is no centralized storage (the tools folder can be seen as storage of course), deleting the folder for the tool can be used as a first step. You can try to remove a specific version in this folder, but I decided to delete it completely.
After deleting that folder and running the EntityFramework command again, you probably get the same error as I had:
Failed to create shell shim for tool 'dotnet-ef': Command 'dotnet-ef' conflicts with an existing command from another tool. Tool 'dotnet-ef' failed to install.
That folder holds information about the version of the tool installed and not the console application itself. Turns out you also need to remove the executable itself. Makes sense when you find that out, but it was not that intuitive the first time.
So remove the executable:
Now you can run the update again. You can specify a version if you want to or leave it off to get the latest.
> dotnet tool update --global dotnet-ef --version 3.1.8