Following this documentation I was able to get everything working successfully.
Do the following:
Remove all .NET packages
sudo apt remove dotnet* sudo apt remove aspnetcore*
Delete PMC repository from APT, using any of the typical methods, for instance by deleting the repo .list file
sudo rm /etc/apt/sources.list.d/microsoft-prod.list
Update APT
sudo apt update
Install .NET SDK 6.0
sudo apt install dotnet-sdk-6.0
I'm guessing something installed incorrectly from the first time I attempted the install leaving everything in that Mixed state scenario 1
I had the same issue and discovered in the dotnet --info
that the path to the dotnet executable was wrong; also the DOTNET_ROOT was wrong.
So there are two more useful commands:
dotnet --list-runtimes
dotnet --info
I found the answer on another question
In short, add a DOTNET_ROOT
variable to your environment. For me, I used the .NET scripted installer and added this to ~/.bashrc
:
export DOTNET_ROOT=~/.dotnet
I was on macOS and got this error while running dotnet ef add migration
.
The solution for me was install the given .NET Runtime in the error message itself, using the link provided.