dotnet / core

.NET news, announcements, release notes, and more!
https://dot.net
MIT License
20.95k stars 4.9k forks source link

Problem encountered on https://dotnet.microsoft.com/en-us/learn/aspnet/blazor-tutorial/create #7735

Closed Jo-Zh closed 2 years ago

Jo-Zh commented 2 years ago

Problem encountered on https://dotnet.microsoft.com/en-us/learn/aspnet/blazor-tutorial/create Operating System: linux

Provide details about the problem you're experiencing. Include your operating system version, exact error message, code sample, and anything else that is relevant. My OS version: LSB Version: core-11.1.0ubuntu4-noarch:printing-11.1.0ubuntu4-noarch:security-11.1.0ubuntu4-noarch Distributor ID: Ubuntu Description: Ubuntu 22.04.1 LTS Release: 22.04 Codename: jammy

When I run dotnet, everything is fine: Usage: dotnet [options] Usage: dotnet [path-to-application]

Options: -h|--help Display help. --info Display .NET information. --list-sdks Display the installed SDKs. --list-runtimes Display the installed runtimes.

path-to-application: The path to an application .dll file to execute.

When I follow the tutorial run this: dotnet new blazorserver -o BlazorApp --no-https -f net6.0, The Error is: The command could not be loaded, possibly because:

Download a .NET SDK: https://aka.ms/dotnet-download

Learn about SDK resolution: https://aka.ms/dotnet/sdk-not-found

I installed dotnet by following the website https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu 22.04

mairaw commented 2 years ago

What does dotnet --info return? Did you install the SDK and not the runtime only, correct?

Jo-Zh commented 2 years ago

Hi, thanks mairaw, I re-edited my description for a better view. This is what happened when I follow the tuorial:

When I run dotnet in terminal, everything is fine, following is the info returned: Usage: dotnet [options] Usage: dotnet [path-to-application]

Options: -h|--help Display help. --info Display .NET information. --list-sdks Display the installed SDKs. --list-runtimes Display the installed runtimes.

path-to-application: The path to an application .dll file to execute.

When I follow the tutorial run this: dotnet new blazorserver -o BlazorApp --no-https -f net6.0, I got the Error as the following: The command could not be loaded, possibly because:

You intended to execute a .NET application: The application 'new' does not exist. You intended to execute a .NET SDK command: No .NET SDKs were found. Download a .NET SDK: https://aka.ms/dotnet-download

Learn about SDK resolution: https://aka.ms/dotnet/sdk-not-found

I have installed many times by following the website https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu 22.04. The info is installed successfully, however, when I run dotnet --list-sdks, show nothing. run dotnet --runtimes returns installed info. I guess my problem is the SDK not installed properly but I tried many times...no problem appears during SDK installation, but it actually not runs on my ubuntu. My OS version: LSB Version: core-11.1.0ubuntu4-noarch:printing-11.1.0ubuntu4-noarch:security-11.1.0ubuntu4-noarch Distributor ID: Ubuntu Description: Ubuntu 22.04.1 LTS Release: 22.04 Codename: jammy

Is there any way I can check what happened during installation or another installation instruction I can follow to install SDK? Thank you!

mairaw commented 2 years ago

Here are some articles that might help: https://docs.microsoft.com/en-us/dotnet/core/install/how-to-detect-installed-versions?pivots=os-linux

Alternatively, you could try downloading the install scripts and using that to install the SDK: https://docs.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install

You can download the script for Linux at https://dot.net/v1/dotnet-install.sh

@leecow any other suggestions?

leecow commented 2 years ago

Sounds like you're running into a conflict with the Microsoft offered .NET install and that which is native to Unbuntu 22.04. Have a look at https://github.com/dotnet/core/issues/7713 for steps to correct.

Jo-Zh commented 2 years ago

Thanks all, problems solved! I actually followed this https://github.com/dotnet/core/issues/7699 with Mixed state scenario 1.