I went to the following official Microsoft link to install .NET Core 6.x (SDK & runtime) and they would not work.

Basically, it tells you to :

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

Then to install SDK you are supposed to run:

sudo apt-get update && sudo apt-get install -y dotnet-sdk-6.0

Then to install runtime it says to run:

sudo apt-get update && sudo apt-get install -y aspnetcore-runtime-6.0

But when I ran all of that, I got a weird thing where the runtime was "half installed".

I could run $ dotnet --list-sdks and it wouldn't report any SDK.

Also, I couldn't run the simple command $ dotnet --version It would state that no SDKs were installed and the command couldn't run. Very confusing.

I also got an error like:

Unable to locate package dotnet-sdk-6.0

Microsoft says to choose the following link to resolve that: APT troubleshooting section.

Tried Snap I also tried installing the snap. Again, dotnet runtime still didn't work properly. I tried various removing and rebooting and many options but could never get the SDK installed properly.

2 Answers 2


I make it run with the APT package solution, in fact there is a conflict between Ubuntu packages (Jammy feed) and Microsoft Package (PMC), more info here: https://github.com/dotnet/core/issues/7699

The solution with the following steps works for me: Use .NET 6 Package via PMC

  1. Remove all .NET packages
sudo apt remove 'dotnet*'
sudo apt remove 'aspnetcore*'
  1. Create the file:
sudo touch /etc/apt/preferences.d/dotnet.pref

with content:

Package: *
Pin: origin "packages.microsoft.com"
Pin-Priority: 1001
  1. Install .NET SDK 6.0
sudo apt update
sudo apt install dotnet-sdk-6.0

And I got the last version of the SDK:

$ dotnet --list-sdks
6.0.400 [/usr/share/dotnet/sdk]
  • Thank you, worked like a charm on Ubuntu 22.04! I used specific version to install: sudo apt install dotnet-sdk-6.0=6.0.301 Aug 20, 2022 at 11:02

The following simple command has fixed the problem for me:

sudo apt dist-upgrade

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .