Error: [/usr/share/dotnet/host/fxr] does not exist

When

Occurs when running dotnet publish --configuration Release or dotnet run

Cause

conflict between the microsoft and ubuntu package repository when dotnet was installed

Solution

Remove all installed dotnet packages

sudo apt remove dotnet* aspnetcore* netstandard*

create a dotnet preference file in /etc/apt/preferences.d with a name like dotnet.pref

Package: *
Pin: origin "packages.microsoft.com"
Pin-Priority: 1001

reinstall dotnet

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

Set static IP in linux

determine the name of your network interface

ip a

make a backup of the netplan configuration

sudo cp /etc/netplan/01-network-manager-all.yaml /etc/netplan/01-network-manager-all.yaml.backup

edit the config file

sudo vim.tiny /etc/netplan/01-network-manager-all.yaml

make the following changes, replacing “interface_name” with the intended interface

network:
  version: 2
  renderer: networkd
  ethernets:
    interface_name:
      addresses:
        - 192.168.1.101/24
      nameservers:
        addresses: [8.8.8.8]
      routes:
        - to: default
          via: 192.168.1.1

try the new configuration

sudo netplan try

If all is good, press ENTER