Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the expected value for DOTNET_ROOT variable when installing dotnet core from tarballs?

Tags:

.net-core

I'm installing dotnet core on Linux ARM64 using tarball as explained here. After installing I followed the suggestion to set DOTNET_ROOT=$PATH:$HOME/dotnet. However global tools fail with A fatal error occurred, the required library libhostfxr.so could not be found.

I fixed by changing the env variable to DOTNET_ROOT=$HOME/dotnet.

Is this a bug in the docs ?

like image 531
rido Avatar asked Oct 08 '18 04:10

rido


2 Answers

Yes, this appears to be a bug in the documentation. The code which interprets DOTNET_ROOT does not split the string on :. DOTNET_ROOT should be set to an absolute file path which points to the directory containing the dotnet executable. If dotnet is on your PATH already, you can set it like this in bash/zsh.

export DOTNET_ROOT="$(dirname $(which dotnet))"
like image 186
natemcmaster Avatar answered Sep 21 '22 12:09

natemcmaster


came across this problem while working on porting .net libraries from Windows to Raspberry PI. On the Raspberry the .net core 3.1 installs in /opt/dotnet, and that's where DOTNET_ROOT ought to point at:

export DOTNET_ROOT="/opt/dotnet"

This should eliminate the "fatal error occurred. The required library libhostfxr.so could not be found." error when attempting to run portable code using the 'dotnet' command on the RPI

like image 42
Andy3D Avatar answered Sep 20 '22 12:09

Andy3D