Princess_Carolyn
Princess_Carolyn

Reputation: 21

Installed .NET 6.0 SDKs not showing with dotnet --info or dotnet --list-sdks and commands depeding on SDK fail (Linux/Ubuntu)

After upgrade to latest dotnet, sdk stopped working. I try to reinstall the latest version but doesn't help.

$ dotnet --info

global.json file:
  Not found

Host:
  Version:      6.0.8
  Architecture: x64
  Commit:       55fb7ef977

.NET SDKs installed:
  No SDKs were found.

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.8 [/usr/lib/dotnet/dotnet6-6.0.108/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.8 [/usr/lib/dotnet/dotnet6-6.0.108/shared/Microsoft.NETCore.App]

Download .NET:
  https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info

Upvotes: 2

Views: 2334

Answers (2)

salihcenap
salihcenap

Reputation: 1947

The following solved the problem for me:

sudo apt dist-upgrade

Upvotes: 0

windperson
windperson

Reputation: 21

There's a workaround on github issue #27129

  1. Remove currently installed packages:
    sudo apt remove dotnet* aspnetcore* -y
    
  2. Add a preference file in /etc/apt/preferences:
    sudo touch /etc/apt/preferences &&
    sudo echo "Package: *" | sudo tee -a /etc/apt/preferences &&
    sudo echo "Pin: origin \"packages.microsoft.com\"" | sudo tee -a /etc/apt/preferences &&
    sudo echo Pin-Priority: 1001 | sudo tee -a /etc/apt/preferences
    
  3. Install .NET 6 SDK again:
    sudo apt update && sudo apt install -y dotnet-sdk-6.0
    

Upvotes: 2

Related Questions