0

I use these commands to install dotnet-sdk and dotnet-runtime

# Get Ubuntu version
declare repo_version=$(if command -v lsb_release &> /dev/null; then lsb_release -r -s; else grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"'; fi)

Download Microsoft signing key and repository

wget https://packages.microsoft.com/config/ubuntu/$repo_version/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

Install Microsoft signing key and repository

sudo dpkg -i packages-microsoft-prod.deb

Clean up

rm packages-microsoft-prod.deb

Update packages

sudo apt update

And also use this command:

sudo apt update
sudo apt upgrade dotnet-sdk-7.0

But when I check dotnet --version

The command could not be loaded, possibly because:
  * You intended to execute a .NET application:
      The application '--version' does not exist.
  * You intended to execute a .NET SDK command:
      No .NET SDKs were found.

Download a .NET SDK: https://aka.ms/dotnet/download

Learn about SDK resolution: https://aka.ms/dotnet/sdk-not-found

And my dotnet --info

Host:
  Version:      7.0.7
  Architecture: x64
  Commit:       5b20af47d9

.NET SDKs installed: No SDKs were found.

.NET runtimes installed: Microsoft.AspNetCore.App 7.0.7 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 7.0.7 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

Other architectures found: None

Environment variables: Not set

global.json file: Not found

Learn more: https://aka.ms/dotnet/info

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

I also use this command sudo apt install dotnet7
Then I try to install dotnet-sdk again, by this command sudo apt install dotnet-sdk-7.0 But

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
dotnet-sdk-7.0 is already the newest version (7.0.304-1).
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

I still face this problem. How can I solve this problem?

0 Answers0