Search code examples
linuxbashubuntu.net-coreapt

Installing .NET SDK on Ubuntu produces no executable dotnet file


Installing .NET SDK on Ubuntu 20.04 with the commands listed in the Install .NET on Ubuntu docs:

wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb

sudo apt-get update; \
  sudo apt-get install -y apt-transport-https && \
  sudo apt-get update && \
  sudo apt-get install -y dotnet-sdk-6.0

produces no dotnet executable.

Command 'dotnet' not found, but can be installed with:

sudo snap install dotnet-sdk

Listing files from the package:

dpkg -L dotnet-sdk-6.0 | grep -P "dotnet$"

gives

/usr/share/dotnet

The /usr/share/dotnet directory contains no executable. I compared this result with my other Ubuntu installation where I installed dotnet ages ago, and there it is installed in /usr/share/dotnet but there exists a /usr/share/dotnet/dotnet executable.

What am I doing wrong? How to install dotnet on Ubuntu with APT?

Using snap is not an option.


Solution

  • sudo apt reinstall dotnet-host and then sudo apt install dotnet-sdk-6.0 fixed the issue.

    See: https://github.com/dotnet/installer/issues/12939