- Saved searches
- Use saved searches to filter your results more quickly
- dotnet: command not found #7298
- dotnet: command not found #7298
- Comments
- `dotnet` command not found after installing using snap
- How can I offline install .NET Core and SDK on Linux (RHEL)?
- 3 Answers 3
- installing .Net dotnet on debian
- dotnet-install.sh not adding dotnet command on Ubuntu
- 2 Answers 2
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dotnet: command not found #7298
dotnet: command not found #7298
Comments
I am using Linux Mint 20.03 Cinnamon x64.
I installed dotnet using the following line of code: curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin —channel Current
When I type ‘dotnet’ in the shell, it says: dotnet: command not found
I creates an alias in .bashrc, like this: alias dotnet=’cd ~/.dotnet;./dotnet’
It is working when I type dotnet. I creates a console project called MyFSharpApp, like this: dotnet new console -lang F# -o MyFSharpApp -f net6.0
user@pc:~/.dotnet$ cd MyFSharpApp
When I type: user@pc:~/.dotnet$ dotnet run . It shows me the following error: Couldn’t find a project to run. Ensure a project exists in /home/user/.dotnet, or pass the path to the project using —project.
Pleas, somebody help me?
The text was updated successfully, but these errors were encountered:
`dotnet` command not found after installing using snap
I’ve install .NET Core on my Ubuntu 18.04 using sudo snap install dotnet-sdk —classic , but after the install process complete, the dotnet command still not working. Here is my console log:
long@long-ub1804:~$ sudo snap install dotnet-sdk [sudo] password for long: error: This revision of snap "dotnet-sdk" was published using classic confinement and thus may perform arbitrary system changes outside of the security sandbox that snaps are usually confined to, which may put your system at risk. If you understand and want to proceed repeat the command including --classic. long@long-ub1804:~$ sudo snap install dotnet-sdk --classic dotnet-sdk 2.2.202 from Microsoft .NET Core (dotnetcore✓) installed long@long-ub1804:~$ dotnet --version Command 'dotnet' not found, but can be installed with: sudo snap install dotnet-sdk long@long-ub1804:~$ snap list Name Version Rev Tracking Publisher Notes chromium 73.0.3683.86 669 stable canonical✓ - core 16-2.38 6673 stable canonical✓ core core18 18 782 stable canonical✓ base docker 18.06.1-ce 321 stable canonical✓ - dotnet-sdk 2.2.202 32 stable dotnetcore✓ classic gnome-3-26-1604 3.26.0.20190228 82 stable/… canonical✓ - gnome-3-28-1804 3.28.0-9-gce87599.ce87599 23 stable canonical✓ - gnome-calculator 3.32.0+git2.cae338ea 352 stable/… canonical✓ - gnome-characters v3.32.0+git1.9ff74a2 206 stable/… canonical✓ - gnome-logs 3.32.0 57 stable/… canonical✓ - gnome-system-monitor 3.32.0 70 stable/… canonical✓ - gtk-common-themes 0.1-16-g2287c87 1198 stable/… canonical✓ - pycharm-community 2019.1.1 123 stable jetbrains✓ classic long@long-ub1804:~$
How can I offline install .NET Core and SDK on Linux (RHEL)?
I have to install .NET Core 2.0 and SDK on a Linux machine (Red Hat Linux (RHEL) distribution) server, where there isn’t any Internet connectivity. How can I do it?
3 Answers 3
I extracted the .NET Core 2.2 package into a directory, /dotnet , on Linux openSUSE 42.1.
sudo ln -sf "/dotnet" "usr/bin/dotnet" export PATH=/usr/bin/dotnet:$netcorepkgs`
Then in the terminal, the dotnet command works:
You can download the binaries for the .NET Core version you are interested at the All Downloads page. Pick the version you are interested in. Then inside that version, there will be a Linux section, select the «x64 Binaries» link, which will download the .tar.gz file you can put on the machine and extract to any directory.
thanks eric, I am able to successfully extract binaries to a folder in RHEL. However, running command ‘dotnet’ results in the error — ‘dotnet: command not found’. should be execute any futher steps after extraction ? ~/coreprojects > dotnet -bash: dotnet: command not found
after setting the path using ‘export PATH=$PATH:$netcorepkgs’, ‘dotnet’ command works only on the directory on which binaries are exported. I have 2 questions 1. How to set path permanently 2. how to make this installation global ? i.e dotnet command should work from any other directory
What our installers do to make this permanently on the $PATH is to create a symbolic link between where dotnet is installed and /usr/bin . You can do this with: sudo ln -sf «/path/where/installed/dotnet» «/usr/bin/dotnet»
These steps worked for me in CentOS 7:
Download these packages on a CentOS 7 system that is connected to the Internet by these commands:
yumdownloader --destdir=/etc/LinuxRepos/DOTNETSDK2.2.402 dotnet-host-3.0.0-x64.rpm yumdownloader --destdir=/etc/LinuxRepos/DOTNETSDK2.2.402 dotnet-runtime-deps-2.2.7-rhel.7-x64.rpm4. yumdownloader --destdir=/etc/LinuxRepos/DOTNETSDK2.2.402 dotnet-runtime-2.2.7-x64.rpm yumdownloader --destdir=/etc/LinuxRepos/DOTNETSDK2.2.402 aspnetcore-runtime-2.2.7-x64.rpm yumdownloader --destdir=/etc/LinuxRepos/DOTNETSDK2.2.402 dotnet-sdk-2.2.402-x64.rpm
Now you have all of necessary rpm’s in the path:
Transfer them to the target offline CentOS system and run these commands (in order) to install SDK 2.2.402:
sudo yum localinstall dotnet-host-3.0.0-x64.rpm sudo yum localinstall dotnet-hostfxr-2.2.7-x64.rpm sudo yum localinstall dotnet-runtime-deps-2.2.7-rhel.7-x64.rpm4. sudo yum localinstall dotnet-runtime-2.2.7-x64.rpm sudo yum localinstall aspnetcore-runtime-2.2.7-x64.rpm sudo yum localinstall dotnet-sdk-2.2.402-x64.rpm
If any one of them failed due to a dependency then download by yumdownloader and install the related dependency.
Run dotnet —version and enjoy!
installing .Net dotnet on debian
$ ./dotnet-install.sh -c Current dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where: dotnet-install: - The SDK needs to be installed without user interaction and without admin rights. dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs. dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer. dotnet-install: .NET Core SDK version 5.0.207 is already installed. dotnet-install: Adding to current process PATH: `/home/tesla/.dotnet`. Note: This change will be visible only when sourcing script. dotnet-install: Note that the script does not resolve dependencies during installation. dotnet-install: To check the list of dependencies, go to https://docs.microsoft.com/dotnet/core/install, select your operating system and check the "Dependencies" section. dotnet-install: Installation finished successfully.
I added path └─$ export PATH=$PATH:/home/tesla/.dotnet dotnet —version 5.0.207 I have two issues: First, everytime I restart the PC, I need to reinstall Second vs code terminal does not see dotnet —version command:
"Command 'dotnet' not found, but can be installed with: sudo snap install dotnet-sdk # version 5.0.401, or sudo apt install dotnet-host See 'snap info dotnet-sdk' for additional versions. "
If I set the path on vscode terminal, after re staring the vscode, it does not recognize dotnet command
dotnet-install.sh not adding dotnet command on Ubuntu
dotnet-install: .NET Core SDK version 2.1.403 is already installed. dotnet-install: Adding to current process PATH:
/home//.dotnet . Note: This change will be visible only when sourcing script. dotnet-install: Installation finished successfully.
- I do . ~/.profile to reload the profile, but even after this when I run dotnet I get the following error:
Command ‘dotnet’ not found, but can be installed with: sudo snap install dotnet-sdk`
I was expecting the script to do everything and make dotnet available.
@miken32 no I did not try that. Because from what I read in the doc, the script was suppose to do it already.
2 Answers 2
TLDR: curl | bash can not modify PATH so it will not add dotnet to your PATH . You need to add dotnet to your path manually. Add export PATH=»$PATH:/home//.dotnet» to your ~/.profile (or ~/.bashrc or equivalent) and log out and log back in.
When you run a command in the shell (for example, bash), the shell tries to find an executible with the name in the all the paths listed in the environment variable PATH . PATH is generally set to something like /bin:/usr/bin . So when you type a command like curl , your shell looks in both /bin and /usr/bin for an executible file named curl .
You can see what your PATH is by doing env | grep PATH or echo $PATH .
The other important piece of information is how environment variables propagate. It’s quite simple, actually:
- A program (or process) can only modify its own set of environment variables.
- Any child processes that a process creates inherit its environment variables.
What this means is that a program that you execute can not modify the environment variables of another random program. The shell actually provides a special command, export to set its own environment variables (and any child processes it later creates will inherit those).
Note the output at the end of step 1.
Note: This change will be visible only when sourcing script.
If you run curl | bash , it runs bash as a child process. That child process can not modify the environment variables of the program that started it (the shell that invoked curl | bash ). So it can not modify PATH to add the location of dotnet to it. It even (helpfully) tells you that it can’t.
In step 2, you are reloading ~/.profile . But does it contain any commands to add dotnet to PATH ? I dont think so. I know the dotnet-install.sh script has not historically added it. You need to add a line like
export PATH="$PATH:/home//.dotnet"
To your ~/.profile (or ~/.bashrc , or equivalent) manually.
Actually, I would write it as follows to make the change more portable to other users:
export PATH="$PATH:$HOME/.dotnet"