Rider cannot detect .NET core installation on Ubuntu
Asked Answered
D

10

20

As instructed by the Rider IDE, I installed the .NET Core framework from Microsoft. I know that the installation was successful since I am able to run the dotnet command from my terminal. However, after restarting Rider, I still get the following message:

Cannot detect .NET Core. Please install .NET Core and restart Rider.

Am I doing anything wrong?

Deflation answered 12/2, 2018 at 3:53 Comment(0)
F
28

I managed to fix the issue setting

/opt/dotnet/dotnet

in

Settings | Build,Execution,Deployment |
  Toolset and Build | .NET Core CLI executable path

enter image description here

Previously, I was using /usr/bin/dotnet, but it doesn't work anymore. Also, auto detect seems to be broken.

Actually, /usr/bin/dotnet, the path returned by which dotnet, is just a shell file defering to /opt/dotnet/dotnet, as its content is:

#!/bin/sh

export DOTNET_ROOT=/opt/dotnet
exec /opt/dotnet/dotnet $@

# vim: ts=2 sw=2 et:
Fabron answered 24/11, 2018 at 6:48 Comment(1)
I installed SDK and runtime and it was showing that it was installed but in Rider it wasn't working I did as you changed the path in the build settings I essentially copied the directory from /usr/share/dotnet to /opt/dotnet and now it works. I was on Ubuntu 22.04.Renter
R
8

I was just experiencing this issue due to a botched install of Xamarin Android on Arch Linux and was able to resolve it by doing the following:

First execute dotnet --info to get the path of .NET Core SDKs installed:

.NET Core SDK (reflecting any global.json): Version: 2.1.500
Commit: b68b931422

Runtime Environment: OS Name: arch OS Version: OS Platform:
Linux RID: arch-x64 Base Path: /opt/dotnet/sdk/2.1.500/

Host (useful for support): Version: 2.1.6 Commit: 3f4f8eebd8

.NET Core SDKs installed:
2.1.500 [/opt/dotnet/sdk]

.NET Core runtimes installed: Microsoft.NETCore.App 2.1.6
[/opt/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

Up one directory at /opt/dotnet/ there should be an executable named "dotnet." The absolute path to this file (/opt/dotnet/dotnet) should be set as the .NET Core CLI executable path value under FileSettingsBuild, Execution, DeploymentToolset and Build settings in Rider.

Just in case, here are my other toolset configuration settings:

Mono executable path: /usr/bin/mono

Use MSBuild version: Auto detected (15,0), /usr/lib/mono/msbuild/bin/MSBuild.dll

I also have the following values added to my PATH in .bashrc due to an error I received regarding Razor not being found:

export MSBuildSDKsPath=/opt/dotnet/sdk/$(dotnet --version)/Sdks

export PATH=${PATH}:${MSBuildSDKsPath}

Rattat answered 22/11, 2018 at 20:55 Comment(0)
U
4

Solution adapted from this answer on YouTrack.

Add the DOTNET_ROOT environment variable in the file launchsettings.json. In my case, it was: "DOTNET_ROOT": "/usr/share/dotnet"

Ursulina answered 2/6, 2023 at 19:12 Comment(1)
This solved it for me. Thanks! (Rider on Ubuntu with .NET 8.0.1 from Microsoft package repositories)Quadrant
I
2

None of these worked for me. I am on PopOS and found a solution here shown in the below screenshot. I think in general it is still a bad idea to install anything from Jetbrains through the Snap store. I've had issues with Intellij and Pycharm as well dating back to ~2014 that were immediately resolved by not using the Snap store.

enter image description here

Internuncial answered 20/5, 2021 at 1:13 Comment(1)
Installed using flatpak. Similar issue. Then used the JetBrains Toolbox and it worked.Rawden
H
1

You can set up the path to .NET CLI in Rider settings: menu File* → SettingsBuild, Execution, DeploymentToolset and Build. But usually Rider should auto detect it.

Please check what you have dotnet in your PATH. Pay attention; you should restart Rider after installing the .NET Core SDK.

Hyderabad answered 12/2, 2018 at 8:38 Comment(3)
@Philippe I'm running into this same problem on Arch after trying to get Xamarin.Android working. Did you find a solution to this problem?Rattat
Also on Arch. I downgraded to the previous version of dotnet (2.1.5). They show up nowGoble
@Rattat on Arch, with DotNet (2.1.500) and Rider (2018.2.3) I managed to fix the issue specifying /opt/dotnet/dotnet in Settings/Build,Execution,Deployment/Toolset and Build/.NET Core CLI executable pathFabron
N
1

My solution was run command dotnet new console on root of project. Then, the templates are showed.

Neoptolemus answered 6/4, 2022 at 18:27 Comment(0)
P
1

In my case despite installing dotnet-sdk-7.0 and dotnet --version command returning correct version, I've been seeing no SDK in dotnet --info.

The problem was that I had dotnet packages installed from different sources. There are a few sources you can download dotnet package: official Ubuntu feed and Microsoft feed. I wanted to use Microsoft feed, as it provided newer versions of dotnet for my distro version, but actually used both.

Here is how you can list all your dotnet packages:

sudo apt list --installed | grep dotnet

Here is how you can check source of your packages:

sudo apt policy dotnet-sdk-7.0

How to fix it

You just need to follow this docs. You need to get rid of official Ubuntu packages and install all of them from one source.

So: Remove all dotnet packages:

sudo apt remove 'dotnet*' 'aspnet*' 'netstandard*'

Create files for apt preferences:

touch /etc/apt/preferences

Inside this file, paste this text. It will configure APT to ignore packages with those names in specific package source:

Package: dotnet* aspnet* netstandard*
Pin: origin "<your-package-source>"
Pin-Priority: -10

So if you configure it like this:

Package: dotnet* aspnet* netstandard*
Pin: origin "archive.ubuntu.com"
Pin-Priority: -10

It will ignore packages from archive.ubuntu.com. So when you install dotnet-sdk-7.0 again, it will omit archive.ubuntu.com and install it from Microsoft source.

You may have different package sources, depending on distro, you can check it like this:

sudo cat /etc/apt/sources.list.d/official-package-repositories.list
Pussy answered 19/11, 2023 at 19:25 Comment(0)
H
0

I made the rather silly mistake of installing .NET Core runtime but forgetting about .NET Core SDK (so the dotnet tool still worked). Once I actually installed the SDK, Rider instantly detected it (.NET 3.1 and Rider 2019.3).

The suggestion to use dotnet --info by masterwok quickly highlights this issue though.

Helve answered 8/3, 2020 at 19:26 Comment(0)
P
0

Neither reinstallation nor path opt/lib64/dotnet works for me.

I have to use the path /var/run/host/usr/lib64/dotnet for .NET cli executable path SDK instead.

Source: https://github.com/flathub/com.jetbrains.Rider/issues/36#issuecomment-1154737584

Peek answered 14/7, 2023 at 7:41 Comment(0)
Q
0

The root cause, in my case, was leftover configuration files from a previous installation of dotnet-sdk from the Ubuntu repositories. I had removed them and installed the packages from the Microsoft packages repository. But I had not completely removed them.

The cause was incorrect paths set in /etc/dotnet/install_location and /etc/dotnet/install_location_x64

The solution was to run sudo apt-get purge dotnet-host-8.0

I was put on track to this solution by this answer from Amjad Abujamous. He was nice enough to include a link to his source, where I found an explanation of the root cause: youtrack.jetbrains.com

Quadrant answered 31/1 at 21:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.