I followed the official instructions to install the latest version of the .NET SDK. I chose the "Package manager (Microsoft feed)" method. After completing these instructions and running dotnet --version
, I get the following output:
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
I read both of those web pages, but they don't provide me with solutions. One brings me back to the beginning of the process for installing the .NET SDK. The other talks about how SDK resolutions works, mostly when applications are run. But this doesn't help me with the CLI tool dotnet
.
I found it interesting that if I ran dotnet --info
, I got the following output, which confirms that it thinks no SDK is installed:
Host:
Version: 7.0.9
Architecture: x64
Commit: 8e9a17b221
.NET SDKs installed:
No SDKs were found.
.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.9 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.9 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_ROOT [/usr/lib/dotnet]
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
I think this is strange because if I use APT to check which packages I have installed, I see output that makes it look like after I followed the official install instructions, I did indeed have one version of the SDK installed (7.0.109):
$ sudo apt list --installed | grep dotnet
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
dotnet-apphost-pack-7.0/jammy-updates,jammy-security,now 7.0.109-0ubuntu1~22.04.1 amd64 [installed,automatic]
dotnet-host-7.0/jammy-updates,jammy-security,now 7.0.109-0ubuntu1~22.04.1 amd64 [installed,automatic]
dotnet-hostfxr-7.0/jammy-updates,jammy-security,now 7.0.109-0ubuntu1~22.04.1 amd64 [installed,automatic]
dotnet-runtime-7.0/jammy-updates,jammy-security,now 7.0.109-0ubuntu1~22.04.1 amd64 [installed,automatic]
dotnet-sdk-7.0/jammy,now 7.0.306-1 amd64 [installed]
dotnet-targeting-pack-7.0/jammy-updates,jammy-security,now 7.0.109-0ubuntu1~22.04.1 amd64 [installed,automatic]