Search code examples
c#.netentity-framework-core

Dotnet 6 dotnet-ef fails after install


I'm on a Pop!_OS 22.04 machine and trying to setup dotnet and dotnet-ef for Entity Framework.

I am running into trouble getting dotnet-ef to work. I have ran

dotnet tool install --global dotnet-ef

but when I go to try to use it I get an error:

You must install .NET to run this application.

App: /home/chewy/.dotnet/tools/dotnet-ef
Architecture: x64
App host version: 6.0.10
.NET location: Not found

Learn about runtime installation:
https://aka.ms/dotnet/app-launch-failed

Download the .NET runtime:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=pop.22.04-x64&apphost_version=6.0.10

I'm not sure why it cannot find my existing dotnet install

dotnet --list-sdks
6.0.402 [/usr/share/dotnet/sdk]

I also saw on other posts a potential fix was to add the tools directory to the path like

cat .bashrc
export PATH="$PATH:$HOME/.dotnet/tools/"

But that hasn't resolved the problem. Any idea what is going on with my install?


Solution

  • Following this documentation I was able to get everything working successfully.

    Do the following:

    Remove all .NET packages
    

    sudo apt remove dotnet* sudo apt remove aspnetcore*

    Delete PMC repository from APT, using any of the typical methods, for instance by deleting the repo .list file
    

    sudo rm /etc/apt/sources.list.d/microsoft-prod.list

    Update APT
    

    sudo apt update

    Install .NET SDK 6.0
    

    sudo apt install dotnet-sdk-6.0

    I'm guessing something installed incorrectly from the first time I attempted the install leaving everything in that Mixed state scenario 1