dotnet tools not working in linux . You must install or update .NET to run this application. App

609 Views Asked by At

It's my information about .NET installed on pc.

dotnet --info

.NET SDK:
 Version:           8.0.100
 Commit:            57efcf1350
 Workload version:  8.0.100-manifests.6c33ef20

Runtime Environment:
 OS Name:     linuxmint
 OS Version:  21.2
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/8.0.100/

.NET workloads installed:
 Workload version: 8.0.100-manifests.6c33ef20
There are no installed workloads to display.

Host:
  Version:      8.0.0
  Architecture: x64
  Commit:       5535e31a71

.NET SDKs installed:
  6.0.417 [/usr/share/dotnet/sdk]
  7.0.404 [/usr/share/dotnet/sdk]
  8.0.100 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.14 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.14 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

dotnet tools installed is

Package Id        Version      Commands 
----------------------------------------
dotnet-ef         8.0.0        dotnet-ef
volo.abp.cli      8.0.0        abp 

when run any dotnet tools recive this error:

oem@behnam ~/.d/tools> dotnet-ef You must install or update .NET to run this application.

App: /home/oem/.dotnet/tools/dotnet-ef Architecture: x64 Framework: 'Microsoft.NETCore.App', version '8.0.0' (x64) .NET location: /usr/lib/dotnet

The following frameworks were found: 6.0.25 at [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

Learn about framework resolution: https://aka.ms/dotnet/app-launch-failed

To install missing framework, download: https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.0&arch=x64&rid=linuxmint.21.2-x64

or

oem@behnam ~/.d/tools [SIGTTOU]> abp You must install or update .NET to run this application.

App: /home/oem/.dotnet/tools/abp Architecture: x64 Framework: 'Microsoft.NETCore.App', version '8.0.0' (x64) .NET location: /usr/lib/dotnet

The following frameworks were found: 6.0.25 at [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

Learn about framework resolution: https://aka.ms/dotnet/app-launch-failed

To install missing framework, download: https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.0&arch=x64&rid=linuxmint.21.2-x64

2

There are 2 best solutions below

0
Behnam Asaei On BEST ANSWER

The issue has been resolved.

1- First, uninstall all installed packages. sudo apt remove --purge --autoremove *dotnet*

2- create preference sudo nano /etc/apt/preferences

3- add these lines

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

4- reinstall .net sudo apt install dotnet-sdk-8.0

5- update (bashrc) nano ~/.bashrc

6- add below PATH

export PATH="$PATH:/usr/share/dotnet"
export PATH="$PATH:~/.dotnet/tools/"
export "DOTNET_ROOT=/usr/share/dotnet"
0
Tim Abell On

For any asdf users out there, this is enough to get dotnet ef to work:

export DOTNET_ROOT=`asdf where dotnet-core`

Currently that sets it to /home/<user>/.asdf/installs/dotnet-core/8.0.100