0

I'm trying to run dotnet 6 program, but it is complaining that the framework is missing.

The sdk is installed as you see:

rami@rami-ThinkPad:~$ dotnet --list-sdks
3.1.426 [/usr/share/dotnet/sdk]
6.0.405 [/usr/share/dotnet/sdk]
7.0.102 [/usr/share/dotnet/sdk]

But when I try to run a program I get this:

dotnet run
Building...
You must install or update .NET to run this application.

App: /home/rami/th-work/internal-mkj-api/Internal-MKJ-API/bin/Debug/net6.0/Internal-MKJ-API
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '6.0.0' (x64)
.NET location: /usr/share/dotnet

The following frameworks were found:
  3.1.32 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  7.0.2 at [/usr/share/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=6.0.0&arch=x64&rid=ubuntu.22.04-x64

This started after I run automatic updates of the Ubuntu and restarted my computer.

RamiR
  • 139
  • 2
  • 8
  • Can you add the output of `dotnet --info` to the question? – omajid Jan 13 '23 at 15:27
  • Thanks, @omajid! Now that I saw output of `dotnet --info` I was able to resolve the issue. Indeed, it showed the sdk installed but not runtime. – RamiR Jan 14 '23 at 05:50

1 Answers1

1

I was able to resolve the issue with help of the tip @omajid gave in the comments. dotnet --info showed the sdk installed but not runtime. Probably the issue was caused by the fact that I had installed different dotnet versions using different sources, i.e. from Ubuntu repo and from Windows. I removed everything and re-installed using just Ubuntu repos and it resolved the issue. Instructions can be found from this answer.

Commands I run:

Remove everything:

sudo apt remove dotnet*
sudo apt remove aspnetcore*
sudo apt remove netstandard*

Delete Microsoft repo and install dotnet-sdk-6:

sudo rm /etc/apt/sources.list.d/microsoft-prod.list
sudo apt update
sudo apt install dotnet-sdk-6.0

RamiR
  • 139
  • 2
  • 8