Skip to content

Instantly share code, notes, and snippets.

@stesee
Created November 26, 2023 09:51
Show Gist options
  • Save stesee/85c72f356bc7a36488622c5911cc72ae to your computer and use it in GitHub Desktop.
Save stesee/85c72f356bc7a36488622c5911cc72ae to your computer and use it in GitHub Desktop.
Get .net 8 @ ubuntu 22.04
# https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#register-the-microsoft-package-repository
# https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu-2204
# https://stackoverflow.com/questions/73312785/dotnet-sdk-is-installed-but-not-recognized-linux-ubuntu-popos-22-04/73394298#73394298
# drops old dependencies and repos
sudo snap remove dotnet-sdk
sudo apt remove 'dotnet*'
sudo apt remove 'aspnetcore*'
sudo apt remove 'netstandard*'
sudo apt autoremove -y
sudo rm /etc/apt/sources.list.d/microsoft-prod.list
sudo rm /etc/apt/sources.list.d/microsoft-prod.list.save
# 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
# get .net 8
sudo apt-get install -y dotnet-sdk-8.0
@Shadowblitz16
Copy link

This is just broke my sdk, now it can't find dotnet.

You must install or update .NET to run this application.

App: /home/shadowblitz16/Documents/Source/cs/SMBX-B/bin/Debug/net7.0/SMBX-B.dll
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '7.0.0' (x64)
.NET location: /usr/share/dotnet/

@stesee
Copy link
Author

stesee commented Feb 9, 2024

@Shadowblitz16 Your code seems to depend on .net7. migrate or install .net7.

@Shadowblitz16
Copy link

@stesee I fixed it by uninstalling all dotnet packages and reinstalling dotnet-sdk-8.0

@stesee
Copy link
Author

stesee commented Feb 10, 2024

I am curious. By which measure have you uninstalled all dotnet backages? I thought that the script already does uninstall all dotnet packages

@Shadowblitz16
Copy link

I don't know I just used apt to uninstall and reinstall it and it worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment