I recently updated my Ubuntu distro to 22.04 from 20 and now it seems I cannot install dotnet sdks correctly. I have dotnet installed with 6 but I need 3.1 now and I don't remember how I did it with dotnet 6.
Here's what I did.
$ 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
$ sudo apt-get update
$ sudo apt-get install dotnet-sdk-3.1
All of those commands finished successfuly. apt-get found the dotnet sdk package and installed it. However, when I call dotnet --list-sdks
, I don't see 3.1.
So my thought is that maybe dotnet is installed differently and can't find SDKs installed using apt-get (below, I've included some debug info for dotnet installation on my machine). But if this is the case, then how do I install them? Everywhere I look online tells me to just use the package manager or snap but none of those work.
Debug Info
Some helpful (let me know if I should include more) debug info.
$ whereis dotnet
dotnet: /usr/bin/dotnet /usr/lib/dotnet /etc/dotnet /usr/share/dotnet /usr/share/man/man1/dotnet.1.gz
$ dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.109
Commit: 58a93139d8
Runtime Environment:
OS Name: ubuntu
OS Version: 22.04
OS Platform: Linux
RID: ubuntu.22.04-x64
Base Path: /usr/lib/dotnet/dotnet6-6.0.109/sdk/6.0.109/
global.json file:
Not found
Host:
Version: 6.0.9
Architecture: x64
Commit: 163a63591c
.NET SDKs installed:
6.0.109 [/usr/lib/dotnet/dotnet6-6.0.109/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.9 [/usr/lib/dotnet/dotnet6-6.0.109/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.9 [/usr/lib/dotnet/dotnet6-6.0.109/shared/Microsoft.NETCore.App]
Download .NET:
https://aka.ms/dotnet-download
Learn about .NET Runtimes and SDKs:
https://aka.ms/dotnet/runtimes-sdk-info
$ sudo apt show dotnet -a
Package: dotnet
State: not a real package (virtual)
N: Can't select versions from package 'dotnet' as it is purely virtual
N: No packages found
$ sudo apt show dotnet-sdk-3.1 -a
Package: dotnet-sdk-3.1
Version: 3.1.424-1
Priority: standard
Section: devel
Maintainer: Microsoft <dotnetcore@microsoft.com>
Installed-Size: 198 MB
Depends: libc6 (>= 2.14), libgcc1 (>= 1:3.0), libstdc++6 (>= 4.6), dotnet-targeting-pack-3.1 (>= 3.1.0), netstandard-targeting-pack-2.1 (>= 2.1.0), dotnet-apphost-pack-3.1 (>= 3.1.30), aspnetcore-targeting-pack-3.1 (>= 3.1.10), dotnet-runtime-3.1 (>= 3.1.30), aspnetcore-runtime-3.1 (>= 3.1.30)
Homepage: https://dotnet.github.io/core
Download-Size: 49.8 MB
APT-Manual-Installed: yes
APT-Sources: https://packages.microsoft.com/ubuntu/22.04/prod jammy/main amd64 Packages
Description: Microsoft .NET Core SDK 3.1.424
.NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs.
Package: dotnet-sdk-3.1
Version: 3.1.423-1
Priority: standard
Section: devel
Maintainer: Microsoft <dotnetcore@microsoft.com>
Installed-Size: 198 MB
Depends: libc6 (>= 2.14), libgcc1 (>= 1:3.0), libstdc++6 (>= 4.6), dotnet-targeting-pack-3.1 (>= 3.1.0), netstandard-targeting-pack-2.1 (>= 2.1.0), dotnet-apphost-pack-3.1 (>= 3.1.29), aspnetcore-targeting-pack-3.1 (>= 3.1.10), dotnet-runtime-3.1 (>= 3.1.29), aspnetcore-runtime-3.1 (>= 3.1.29)
Homepage: https://dotnet.github.io/core
Download-Size: 49.8 MB
APT-Sources: https://packages.microsoft.com/ubuntu/22.04/prod jammy/main amd64 Packages
Description: Microsoft .NET Core SDK 3.1.423
.NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs.