Skip to content
New issue

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

I received the Command 'dotnet' not found, but can be installed with error #60438

Open
Tracked by #62241
andresianipar opened this issue Sep 27, 2020 · 13 comments
Open
Tracked by #62241
Milestone

Comments

@andresianipar
Copy link

Problem encountered on https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/install
Operating System: Ubuntu 18.04.5 LTS

Provide details about the problem you're experiencing. Include your operating system version, exact error message, code sample, and anything else that is relevant.
I followed the instructions on the link below:

  1. https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/install
  2. https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#1804-
    2.1. Add Microsoft package signing key and add package repository
    2.2. Install the SDK

then in the new terminal I run the following command:

/$ dotnet

Command 'dotnet' not found, but can be installed with:

sudo snap install dotnet-sdk

try to check if .NET Core is already installed:

/$ sudo apt list | grep dotnet

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

dotnet-apphost-pack-3.0/bionic 3.0.3-1 amd64
dotnet-apphost-pack-3.1/bionic 3.1.8-1 amd64
dotnet-dev-1.1.11/bionic 1.1.11-1 amd64
dotnet-dev-1.1.13/bionic 1.1.13-1 amd64
dotnet-dev-1.1.14/bionic 1.1.14-1 amd64
dotnet-host/bionic 3.1.8-1 amd64
dotnet-hostfxr-1.1.10/bionic 1.1.10-1 amd64
dotnet-hostfxr-1.1.11/bionic 1.1.11-1 amd64
dotnet-hostfxr-1.1.12/bionic 1.1.12-1 amd64
dotnet-hostfxr-1.1.13/bionic 1.1.13-1 amd64
dotnet-hostfxr-1.1.9/bionic 1.1.9-1 amd64
dotnet-hostfxr-2.0.7/bionic 2.0.7-1 amd64
dotnet-hostfxr-2.0.9/bionic 2.0.9-1 amd64
dotnet-hostfxr-2.1/bionic 2.1.22-1 amd64
dotnet-hostfxr-2.1.0-preview2-26406-04/bionic 2.1.0-preview2-26406-04-1 amd64
dotnet-hostfxr-2.1.0-rc1/bionic 2.1.0-rc1-1 amd64
dotnet-hostfxr-2.2/bionic 2.2.8-1 amd64
dotnet-hostfxr-3.0/bionic 3.0.3-1 amd64
dotnet-hostfxr-3.1/bionic 3.1.8-1 amd64
dotnet-hosting-2.0.7/bionic 2.0.7-1 amd64
dotnet-hosting-2.0.8/bionic 2.0.8-1 amd64
dotnet-hosting-2.0.9/bionic 2.0.9-1 amd64
dotnet-runtime-2.0.7/bionic 2.0.7-1 amd64
dotnet-runtime-2.0.9/bionic 2.0.9-1 amd64
dotnet-runtime-2.1/bionic 2.1.22-1 amd64
dotnet-runtime-2.1.0-preview2-26406-04/bionic 2.1.0-preview2-26406-04-1 amd64
dotnet-runtime-2.1.0-rc1/bionic 2.1.0-rc1-1 amd64
dotnet-runtime-2.2/bionic 2.2.8-1 amd64
dotnet-runtime-3.0/bionic 3.0.3-1 amd64
dotnet-runtime-3.1/bionic 3.1.8-1 amd64
dotnet-runtime-deps-2.1/bionic 2.1.22-1 amd64
dotnet-runtime-deps-2.2/bionic 2.2.8-1 amd64
dotnet-runtime-deps-3.0/bionic 3.0.3-1 amd64
dotnet-runtime-deps-3.1/bionic 3.1.8-1 amd64
dotnet-sdk-2.1/bionic 2.1.810-1 amd64
dotnet-sdk-2.1.105/bionic 2.1.105-1 amd64
dotnet-sdk-2.1.200/bionic 2.1.200-1 amd64
dotnet-sdk-2.1.201/bionic 2.1.201-1 amd64
dotnet-sdk-2.1.202/bionic 2.1.202-1 amd64
dotnet-sdk-2.1.300-preview2-008533/bionic 2.1.300-preview2-008533-1 amd64
dotnet-sdk-2.1.300-rc1-008673/bionic 2.1.300-rc1-008673-1 amd64
dotnet-sdk-2.2/bionic 2.2.402-1 amd64
dotnet-sdk-3.0/bionic 3.0.103-1 amd64
dotnet-sdk-3.1/bionic 3.1.402-1 amd64
dotnet-sharedframework-microsoft.netcore.app-1.0.16/bionic 1.0.16-1 amd64
dotnet-sharedframework-microsoft.netcore.app-1.1.10/bionic 1.1.10-1 amd64
dotnet-sharedframework-microsoft.netcore.app-1.1.12/bionic 1.1.12-1 amd64
dotnet-sharedframework-microsoft.netcore.app-1.1.13/bionic 1.1.13-1 amd64
dotnet-sharedframework-microsoft.netcore.app-1.1.9/bionic 1.1.9-1 amd64
dotnet-targeting-pack-3.0/bionic 3.0.1-1 amd64
dotnet-targeting-pack-3.1/bionic 3.1.0-1 amd64
libgtk-dotnet3.0-cil/bionic 2.99.3-2 amd64
libgtk-dotnet3.0-cil-dev/bionic 2.99.3-2 amd64

Any help will be appreciated. Thank you

@andresianipar andresianipar changed the title I receive a Command 'dotnet' not found, but can be installed with error I received the Command 'dotnet' not found, but can be installed with error Sep 27, 2020
@danmoseley
Copy link
Member

@rbhanda can you help?

@rbhanda
Copy link
Contributor

rbhanda commented Sep 30, 2020

You are trying to install .NET Core using Package Manager.
I followed the commands as mentioned in the docs

wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update; \ sudo apt-get install -y apt-transport-https && \ sudo apt-get update && \ sudo apt-get install -y dotnet-sdk-3.1

I was able to install .NET Core SDK 3.1

After I ran dotnet --info

Output:

.NET Core SDK (reflecting any global.json): Version: 3.1.402
Commit: 9b5de826fd
Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /usr/share/dotnet/sdk/3.1.402/
Host (useful for support):
Version: 3.1.8
Commit: 9c1330dedd
.NET Core SDKs installed: 3.1.402 [/usr/share/dotnet/sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.App 3.1.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download

@andresianipar
Copy link
Author

You are trying to install .NET Core using Package Manager.
I followed the commands as mentioned in the docs

wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update; \ sudo apt-get install -y apt-transport-https && \ sudo apt-get update && \ sudo apt-get install -y dotnet-sdk-3.1

I was able to install .NET Core SDK 3.1

After I ran dotnet --info

Output:

.NET Core SDK (reflecting any global.json): Version: 3.1.402
Commit: 9b5de826fd
Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /usr/share/dotnet/sdk/3.1.402/
Host (useful for support):
Version: 3.1.8
Commit: 9c1330dedd
.NET Core SDKs installed: 3.1.402 [/usr/share/dotnet/sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.App 3.1.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download

The links and instructions that you have described are exactly what I have followed and mentioned in my first comment. Am I missing something?

@andresianipar
Copy link
Author

Okay now I've installed the SDK from Snap based on this subarticle, then I type dotnet --info and get:

.NET Core SDK (reflecting any global.json):
 Version:   3.1.402
 Commit:    9b5de826fd

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  18.04
 OS Platform: Linux
 RID:         ubuntu.18.04-x64
 Base Path:   /snap/dotnet-sdk/98/sdk/3.1.402/

Host (useful for support):
  Version: 3.1.8
  Commit:  9c1330dedd

.NET Core SDKs installed:
  3.1.402 [/snap/dotnet-sdk/98/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.8 [/snap/dotnet-sdk/98/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.8 [/snap/dotnet-sdk/98/shared/Microsoft.NETCore.App]

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

I can now run dotnet commands from terminal. Next I installed the C# extension for VS Code then encountered this problem:

...
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/home/andre/PAYFAZZ/dotnet-sample-code' on host 24053.
It was not possible to find any installed .NET SDKs.
Install a .NET SDK from:
  https://aka.ms/dotnet-download
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/home/andre/PAYFAZZ/dotnet-sample-code/dotnet-sample-code.csproj'.
/home/andre/PAYFAZZ/dotnet-sample-code/dotnet-sample-code.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk.Web' specified could not be found.  /home/andre/PAYFAZZ/dotnet-sample-code/dotnet-sample-code.csproj
  at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject (System.String errorSubCategoryResourceName, Microsoft.Build.Shared.
...

What am I missing here? Please help. I'm only one step away from starting coding

@andresianipar
Copy link
Author

@rbhanda

@rbhanda
Copy link
Contributor

rbhanda commented Oct 1, 2020

I am not sure why you are getting this error but are the steps mentioned on this comment or on stackoverflow useful?

@andresianipar
Copy link
Author

Stack Overflow answers help! Since I installed .NET from Snap, I've had to launch VS Code with this command:

MSBuildSDKsPath="/snap/dotnet-sdk/98/sdk/$(dotnet --version)/Sdks" code

Will .NET 5.0 GA come with full support for Ubuntu? Means no need for a workaround like this anymore

@carlossanlop
Copy link
Member

This issue seems to be resolved.

@rbhanda can you answer the last question and close this issue?

@carlossanlop
Copy link
Member

Ping again @rbhanda

@rbhanda
Copy link
Contributor

rbhanda commented Nov 6, 2020

It looks like the original issue dotnet/sdk#10403 is still open. I will follow up on this and let you know if this is resolved

@yilmazbingo
Copy link

yilmazbingo commented Sep 20, 2021

i had the same issue. I think I had added the wrong path in the e first place

installed the script:

[]($ ./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 env variable

   export PATH=$PATH:/home/tesla/.dotnet

I tested the version

          $ dotnet --version                     
            5.0.207

@mairaw mairaw transferred this issue from dotnet/core Oct 14, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added area-Host untriaged New issue has not been triaged by the area owner labels Oct 14, 2021
@ghost
Copy link

ghost commented Oct 14, 2021

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

Issue Details

Problem encountered on https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/install
Operating System: Ubuntu 18.04.5 LTS

Provide details about the problem you're experiencing. Include your operating system version, exact error message, code sample, and anything else that is relevant.
I followed the instructions on the link below:

  1. https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/install
  2. https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#1804-
    2.1. Add Microsoft package signing key and add package repository
    2.2. Install the SDK

then in the new terminal I run the following command:

/$ dotnet

Command 'dotnet' not found, but can be installed with:

sudo snap install dotnet-sdk

try to check if .NET Core is already installed:

/$ sudo apt list | grep dotnet

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

dotnet-apphost-pack-3.0/bionic 3.0.3-1 amd64
dotnet-apphost-pack-3.1/bionic 3.1.8-1 amd64
dotnet-dev-1.1.11/bionic 1.1.11-1 amd64
dotnet-dev-1.1.13/bionic 1.1.13-1 amd64
dotnet-dev-1.1.14/bionic 1.1.14-1 amd64
dotnet-host/bionic 3.1.8-1 amd64
dotnet-hostfxr-1.1.10/bionic 1.1.10-1 amd64
dotnet-hostfxr-1.1.11/bionic 1.1.11-1 amd64
dotnet-hostfxr-1.1.12/bionic 1.1.12-1 amd64
dotnet-hostfxr-1.1.13/bionic 1.1.13-1 amd64
dotnet-hostfxr-1.1.9/bionic 1.1.9-1 amd64
dotnet-hostfxr-2.0.7/bionic 2.0.7-1 amd64
dotnet-hostfxr-2.0.9/bionic 2.0.9-1 amd64
dotnet-hostfxr-2.1/bionic 2.1.22-1 amd64
dotnet-hostfxr-2.1.0-preview2-26406-04/bionic 2.1.0-preview2-26406-04-1 amd64
dotnet-hostfxr-2.1.0-rc1/bionic 2.1.0-rc1-1 amd64
dotnet-hostfxr-2.2/bionic 2.2.8-1 amd64
dotnet-hostfxr-3.0/bionic 3.0.3-1 amd64
dotnet-hostfxr-3.1/bionic 3.1.8-1 amd64
dotnet-hosting-2.0.7/bionic 2.0.7-1 amd64
dotnet-hosting-2.0.8/bionic 2.0.8-1 amd64
dotnet-hosting-2.0.9/bionic 2.0.9-1 amd64
dotnet-runtime-2.0.7/bionic 2.0.7-1 amd64
dotnet-runtime-2.0.9/bionic 2.0.9-1 amd64
dotnet-runtime-2.1/bionic 2.1.22-1 amd64
dotnet-runtime-2.1.0-preview2-26406-04/bionic 2.1.0-preview2-26406-04-1 amd64
dotnet-runtime-2.1.0-rc1/bionic 2.1.0-rc1-1 amd64
dotnet-runtime-2.2/bionic 2.2.8-1 amd64
dotnet-runtime-3.0/bionic 3.0.3-1 amd64
dotnet-runtime-3.1/bionic 3.1.8-1 amd64
dotnet-runtime-deps-2.1/bionic 2.1.22-1 amd64
dotnet-runtime-deps-2.2/bionic 2.2.8-1 amd64
dotnet-runtime-deps-3.0/bionic 3.0.3-1 amd64
dotnet-runtime-deps-3.1/bionic 3.1.8-1 amd64
dotnet-sdk-2.1/bionic 2.1.810-1 amd64
dotnet-sdk-2.1.105/bionic 2.1.105-1 amd64
dotnet-sdk-2.1.200/bionic 2.1.200-1 amd64
dotnet-sdk-2.1.201/bionic 2.1.201-1 amd64
dotnet-sdk-2.1.202/bionic 2.1.202-1 amd64
dotnet-sdk-2.1.300-preview2-008533/bionic 2.1.300-preview2-008533-1 amd64
dotnet-sdk-2.1.300-rc1-008673/bionic 2.1.300-rc1-008673-1 amd64
dotnet-sdk-2.2/bionic 2.2.402-1 amd64
dotnet-sdk-3.0/bionic 3.0.103-1 amd64
dotnet-sdk-3.1/bionic 3.1.402-1 amd64
dotnet-sharedframework-microsoft.netcore.app-1.0.16/bionic 1.0.16-1 amd64
dotnet-sharedframework-microsoft.netcore.app-1.1.10/bionic 1.1.10-1 amd64
dotnet-sharedframework-microsoft.netcore.app-1.1.12/bionic 1.1.12-1 amd64
dotnet-sharedframework-microsoft.netcore.app-1.1.13/bionic 1.1.13-1 amd64
dotnet-sharedframework-microsoft.netcore.app-1.1.9/bionic 1.1.9-1 amd64
dotnet-targeting-pack-3.0/bionic 3.0.1-1 amd64
dotnet-targeting-pack-3.1/bionic 3.1.0-1 amd64
libgtk-dotnet3.0-cil/bionic 2.99.3-2 amd64
libgtk-dotnet3.0-cil-dev/bionic 2.99.3-2 amd64

Any help will be appreciated. Thank you

Author: andresianipar
Assignees: -
Labels:

area-Host, untriaged

Milestone: -

@NikolaMilosavljevic NikolaMilosavljevic removed the untriaged New issue has not been triaged by the area owner label Dec 8, 2021
@NikolaMilosavljevic NikolaMilosavljevic added this to the Future milestone Aug 17, 2022
@lthoedt
Copy link

lthoedt commented Aug 25, 2022

export PATH=$PATH:/home/tesla/.dotnet

You saved my week! I have been working on this for days holy shit thank you!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants