I installed dotnet-sdk
using snap in Ubuntu v.22.04
. When I run dotnet --info
here are the details:
dotnet --info
.NET SDK:
Version: 8.0.100
Commit: 57efcf1350
Workload version: 8.0.100-manifests.6c33ef20
Runtime Environment:
OS Name: ubuntu
OS Version: 22.04
OS Platform: Linux
RID: linux-x64
Base Path: /snap/dotnet-sdk/233/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:
8.0.100 [/snap/dotnet-sdk/233/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.0 [/snap/dotnet-sdk/233/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.0 [/snap/dotnet-sdk/233/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_ROOT [/snap/dotnet-sdk/current]
the latest dotnet-sdk
isn't available in ubuntu's feed; therefore, I had to install it using snap. I also have the DOTNET_ROOT
env. variable setup because this is a known issue and the solution is outlined in this post.
After installing dotnet-ef
by running dotnet tool install --global dotnet-ef
, when I run dotnet ef
, I get the following exception:
You must install or update .NET to run this application.
App: /home/akhakpouri_linux/.dotnet/tools/dotnet-ef
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '8.0.1' (x64)
.NET location: /snap/dotnet-sdk/233
The following frameworks were found:
8.0.0 at [/snap/dotnet-sdk/233/shared/Microsoft.NETCore.App]
Learn more:
https://aka.ms/dotnet/app-launch-failed
I've exhausted all resources and not sure what else to do.
For the record, if you're installing dotnet-sdk-8.0.xx
using snap, you'll run into this issue no matter what you've set the DOTNET_ROOT
to. The problem is that snap installs the sdk in /snap/dotnet-sdk
instead of $home/.dotnet/sdk
.
The only way I've been able to get both .net-sdk
and dotnet-ef
to work is to perform the followings:
dotnet-sdk
by snap remove dotnet-sdk
.dotnet
directory by rm ~/.dotnet
rm /snap/dotnet
or /rm /snap/dotnet-sdk
if they exist.You want to install the dotnet-sdk
using script installation mentioned on microsfot's documentation. After running through the installation, make sure to follow the steps in Set environment variables system-wide here.