Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 6763  / 3 Years ago, wed, september 1, 2021, 12:08:33

I went to the following official Microsoft link to install .NET Core 6.x (SDK & runtime) and they would not work.


Basically, it tells you to :


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

Then to install SDK you are supposed to run:


sudo apt-get update && sudo apt-get install -y dotnet-sdk-6.0

Then to install runtime it says to run:


sudo apt-get update && sudo apt-get install -y aspnetcore-runtime-6.0

But when I ran all of that, I got a weird thing where the runtime was "half installed".


I could run $ dotnet --list-sdks and it wouldn't report any SDK.


Also, I couldn't run the simple command $ dotnet --version It would state that no SDKs were installed and the command couldn't run. Very confusing.


I also got an error like:



Unable to locate package dotnet-sdk-6.0



Microsoft says to choose the following link to resolve that: APT troubleshooting section.


Tried Snap
I also tried installing the snap. Again, dotnet runtime still didn't work properly.
I tried various removing and rebooting and many options but could never get the SDK installed properly.


More From » development

 Answers
2

Only Manual Install Works


I finally installed .NET Core 6.x SDK & runtime manually, by following the steps at: https://docs.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#manual-install


I downloaded .NET Core 6.x SDK & runtime tar gz.


Next, I opened a terminal and I ran each of the following, one at a time:


$ DOTNET_FILE=dotnet-sdk-6.0.400-linux-x64.tar.gz
$ export DOTNET_ROOT=$(pwd)/.dotnet
$ mkdir -p "$DOTNET_ROOT" && tar zxf "$DOTNET_FILE" -C "$DOTNET_ROOT"
$ export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools

Right after I did that I was able to run:


$ dotnet --version and I saw the appropriate output: 6.0.400


Next, I tried listing the SDKS:


$ dotnet --list-sdks and I saw: 6.0.400 [/home/raddev/Downloads/.dotnet/sdk]


I built a sample program and ran it and now everything works.


It seems you have to manually do this install.


After that I had to edit my ~/.bashrc and add the two following lines as the last two lines, so that appropriate folders would always be available via path.


export PATH=$PATH:$HOME/.dotnet
export DOTNET_ROOT=$HOME/.dotnet

Update (2022-08-16)


This article was just released today:
Microsoft and Canonical announce native .NET availability in Ubuntu 22.04 hosts and containers -- Sub-title Install .NET 6 with one apt install command.


Here's the main point:


install .net on 22.04


[#315] Friday, September 3, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
naldis

Total Points: 257
Total Questions: 101
Total Answers: 111

Location: Kenya
Member since Sat, Feb 25, 2023
1 Year ago
naldis questions
Sun, Jan 22, 23, 23:18, 1 Year ago
Thu, May 27, 21, 12:56, 3 Years ago
Thu, Mar 24, 22, 02:47, 2 Years ago
Sun, Jun 12, 22, 04:41, 2 Years ago
;