Sunday, 1 March 2020

the required library libhostfxr.so could not be found

Problem: Running .net core 3.1 app on a Raspberry Pi returns
"the required library libhostfxr.so could not be found."

check
dotnet --version
echo $DOTNET_ROOT

if the second line is empty then the environment variable needs to be set at startup.

Add a file set_dotnetroot.sh to /etc/profile.d
sudo nano /etc/profile.d/set_dotnet.sh

add
export DOTNET_ROOT="/opt/dotnet"

save and reboot

If you want it to run for su too, especially if running a su crontab,
edit /etc/bash.bashrc and add it there too.

No comments:

Post a comment