Background
When working with .NET SDK in Rider, you might encounter the error like below:
Could not execute because the specified command or file was not found. Possible reasons for this include: *** You misspelled a built-in dotnet command.** *** You intended to execute a .NET program, but dotnet-ef does not exist.** *** You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.**
The problem is sometimes reported by the Entity Framework Core UI plugin, as it's trying to execute dotnet-ef command for actions.
Below, we explain how Rider scans for the SDK and how to resolve common issues.
Question
Which places will be scanned by Rider to locate dotnet and related CLI tools?
Answer
JetBrains Rider scans specific directories to locate the .NET SDK based on your operating system:
Windows:
- Checks ProgramFiles/dotnet (e.g.,
C:\Program Files\dotnet). - Checks ProgramFilesX86/dotnet (e.g.,
C:\Program Files (x86)\dotnet).
Linux:
- Snap installations (e.g.
/snap/bin). - Common paths:
- /home/linuxbrew/.linuxbrew/bin/dotnet
- /opt/dotnet, /usr/bin, /usr/local/bin
- /usr/local/share/dotnet, /usr/share/dotnet
- Flatpak/Snap-specific paths (e.g., /var/run/host/usr/lib/dotnet).
-
asdf version manager: Scans
~/.asdf/installs/dotnet-corefor installed SDK versions.
macOS:
- Checks
/usr/bin,/usr/local/bin,/usr/local/share/dotnet, and/usr/share/dotnet.
Rider uses these paths to detect the SDK and tools like dotnet-ef. If the SDK is installed outside these directories, Rider may fail to recognize it.
Solutions
Follow these steps to verify the .NET SDK installations on your machine:
1. Verify .NET SDK Installation
- Run
dotnet --list-sdksin your terminal. - If no SDKs appear, install the .NET SDK.
2. Check Installation Paths
- Ensure the SDK is installed in a directory Rider scans for your OS (see the Answer section).
- Prevent using soft links point to the SDK physical path on Linux/macOS.
3. Validate Global Tools
- If the error mentions a tool (e.g.,
dotnet-ef):
- Install the tool globally:
dotnet tool install --global dotnet-ef
- Ensure the tool’s path (typically ~/.dotnet/tools on Linux/macOS or %USERPROFILE%\.dotnet\tools on Windows) is in your system’s PATH.
4. Check Environment Variables
- Confirm the SDK’s directory is in the system
PATH:
- Linux/macOS: Verify with echo $PATH.
- Windows: Check in System Properties > Advanced > Environment Variables.
- Restart Rider after modifying `PATH` to ensure changes take effect.
5. Reinitialize Rider
- Invalid caches or incorrect environment detection can cause issues. Go to
File > Invalidate Cachesand restart Rider.
If the problem persists,
- Manually specify the SDK path in Rider under
File > Settings > Build, Execution, Deployment > Toolset and Build. - Edit the run configuration and set "Runtime" to a custom path.
Still stuck?
Contact JetBrains Rider Support for further guidance.
Comments
0 comments
Please sign in to leave a comment.