WCS
WCS

Reputation: 99

.NET Core 3.1 installed on Fedora 32 but it doesn't work

The dotnet program is in the directory '/usr/bin/dotnet'. When I switch to that directory and run dotnet new web, all I get is:

It was not possible to find any installed .NET Core SDKs Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:> https://aka.ms/dotnet-download

Suggestions?

Upvotes: 0

Views: 434

Answers (2)

leat
leat

Reputation: 1467

I had to do this:

sudo mv /usr/share/dotnet/sdk/* /usr/lib64/dotnet/sdk/

And similar after that when i do dotnet --list-sdks it all works

but I did have to reset my terminal / Restart my IDE (rider)

Upvotes: 0

samael
samael

Reputation: 2168

When I switch to that directory

Don't run dotnet new from within the /usr/bin directory. What's in there is a symlink to the actual binary so that it's available on your PATH. So /usr/bin/dotnet will likely point to a location such as /usr/lib64/dotnet/dotnet. You should be able to run dotnet from any location that your user has access to.

It's likely that the problem, is related to the fact that dotnet-sdk-3.1 is now available in the official fedora repo as well as the microsoft repos so you may have a mix of binaries that are incompatible.

I had a similar problem today where I had a mix of packages like the following installed:

dotnet-apphost-pack-3.1   x86_64    3.1.8-1.fc32    @updates
dotnet-host               x86_64    3.1.8-1.fc32    @updates
dotnet-hostfxr-3.1        x86_64    3.1.8-1.fc32    @updates
dotnet-runtime-3.1        x86_64    3.1.8-1.fc32    @updates
dotnet-runtime-deps-3.1   x86_64    3.1.8-1         @packages-microsoft-com-prod
dotnet-sdk-3.1            x86_64    3.1.402-1       @packages-microsoft-com-prod
dotnet-targeting-pack-3.1 x86_64    3.1.8-1.fc32    @updates
...

it turned out the packages I'd installed before from Microsoft's repo don't play well with the Fedora ones (the ones with .fc32).

To solve this I simply needed to uninstall all my dotnet packages: sudo dnf remove dotnet-* then set the priority of the fedora repos to be higher than microsofts. This is done by editing the affected repos such as /etc/yum.repos.d/fedora.repo and adding:

priority = N (where N is a number between 1 and 99)

I set fedora's repos to priority 1 (they really should do that anyway) and microsofts repos to 5.

Then simply install again, this time it will pull down from Fedora repo:

sudo dnf install dotnet-sdk-3.1

And now it's more like:

dotnet-sdk-3.1            x86_64    3.1.108-1.fc32  @updates
dotnet-apphost-pack-3.1   x86_64    3.1.8-1.fc32    @updates
dotnet-host               x86_64    3.1.8-1.fc32    @updates
dotnet-hostfxr-3.1        x86_64    3.1.8-1.fc32    @updates
dotnet-runtime-3.1        x86_64    3.1.8-1.fc32    @updates
dotnet-targeting-pack-3.1 x86_64    3.1.8-1.fc32    @updates
...

and everythings working as it should be. Running dotnet --list-sdks outputs: 3.1.108 [/usr/lib64/dotnet/sdk]

Upvotes: 2

Related Questions