I was working with Ubuntu 22.04 and I found an issue installing dotnet basically, I was getting an error message: /usr/share/dotnet/host/fxr does not exist
After spending some time in Google, I found an easy fix.
First, remove the dotnet core packages you have installed in the system by executing the following steps:
sudo apt remove dotnet*
sudo apt remove aspnetcore*
sudo apt remove netstandard*
Next, make sure to either choose the Microsoft repository or the Ubuntu one, in this case, I will use the Ubuntu repository therefore I will remove the Microsoft source by executing the next step
rm /etc/apt/sources.list.d/microsoft-prod.list
Finally, let’s execute the following steps to install it
sudo apt update
sudo apt install dotnet-sdk-6.0
That’s it, hope this helps.